首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

JPA引语配置实例

2012-06-30 
JPA注解配置实例以下收集了一些JPA常用的注解实例:@Entity@Table(nameACCOUNT_INFO)public class Manag

JPA注解配置实例

以下收集了一些JPA常用的注解实例:

@Entity@Table(name="ACCOUNT_INFO")public class ManagerAccountInfo implements Serializable {private static final long serialVersionUID = -1021341410178291401L;private Long id;private String loginAccount;private Date lastLoginDate;private ManagerOperator managerOperator;private Set<FrameworkAccountLevel> frameworkAccountLevels;private String officeNo;//标识字段@Id@GeneratedValue(generator = "Cjm-Generator")    @GenericGenerator(name = "Cjm-Generator", strategy = "com.cjm.core.utils.IdGenerator")@Column(name="id")public Long getId() {return id;}public void setId(Long id) {this.id = id;}//普通字段@Column(name = "LOGIN_ACCOUNT")public String getLoginAccount() {return this.loginAccount;}public void setLoginAccount(String loginAccount) {this.loginAccount = loginAccount;}//日期字段@Temporal(TemporalType.DATE)@Column(name = "LAST_LOGIN_DATE")public Date getLastLoginDate() {return this.lastLoginDate;}public void setLastLoginDate(Date lastLoginDate) {this.lastLoginDate = lastLoginDate;}//多对一@ManyToOne(fetch = FetchType.LAZY)@JoinColumn(name = "MO_ID",   referencedColumnName = "MO_ID")public ManagerOperator getManagerOperator() {return this.managerOperator;}public void setManagerOperator(ManagerOperator managerOperator) {this.managerOperator = managerOperator;}//一对多@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "managerAccountInfo")public Set<FrameworkAccountLevel> getFrameworkAccountLevels() {return this.frameworkAccountLevels;}public void setFrameworkAccountLevels(Set<FrameworkAccountLevel> frameworkAccountLevels) {this.frameworkAccountLevels = frameworkAccountLevels;}//非持久化字段@Transientpublic String getOfficeNo() {return officeNo;}public void setOfficeNo(String officeNo) {this.officeNo = officeNo;}}

??

热点排行