我使用Eclipse Hibernate Tools从我的数据库创建域类,并需要添加JPA注释。
有没有一种方法可以添加注释?可能是通过reveng.xml和反向工程?应该如何操作?
生成的域代码:
有没有一种方法可以添加注释?可能是通过reveng.xml和反向工程?应该如何操作?
生成的域代码:
public class Country implements java.io.Serializable {
private long id;
private String description;
private String identifier;
private String futureuse;
private Set accounts = new HashSet(0);
public Country() {
}
public Country(long id, String description, String identifier) {
this.id = id;
this.description = description;
this.identifier = identifier;
}
...
需要的代码:
@Entity
@Table(name = "COUNTRY")
public class Country implements java.io.Serializable {
@Id
@Column(name="CNTR_ID")
private Long id;
@Column(name="CNTR_FUTUREUSE")
private String futureUse;
@Column(name="CNTR_IDENTIFIER")
private String identifier;
@Column(name="CNTR_DESCRIPTION")
private String description;
private Set accounts = new HashSet(0);
public Country() {
}
public Country(long id, String description, String identifier) {
this.id = id;
this.description = description;
this.identifier = identifier;
}
...