常用注解
目录:
1、spring注解
2、json注解
5、solr注解
spring注解:
json注解:
1、@JsonIgnoreProperties(ignoreUnknown=true)
json转换为实体对象时,对json中存在的数据而实体对象并没有对应的属性来接收赋值,可以使用此注解标示进行忽略。
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
mybatis注解:
通过mapper注解:
1、@Table(name="student_section")
import javax.persistence.Table;
标示当前实体类的数据库名
2、@GeneratedValue(strategy=GenerationType.IDENTITY)
标示主键自动增
所属包:
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
3、@Id
标示主键
import javax.persistence.Id;
4、@Transient
import javax.persistence.Transient;
orm中实体对象中的属性在数据库中并没有对应的字段,可以使用此注解标示进行忽略
solr注解:
1、@Field(value="title")
import org.apache.solr.client.solrj.beans.Field;
将对象属性与solr索引的文件属性一一对应