覆蓋的屬性的通用實體,超類:休眠:如何從映射超類
@MappedSuperclass
public abstract class GenericEntity {
private Integer id;
public Integer getId() {return id;}
public void setId(Integer id) {this.id = id;}
}
的POJO:
@Entity
@Table(name = "POJO_ONE")
@SequenceGenerator(name = "HB_SEQ_POJO_ONE", sequenceName = "SEQ_POJO_ONE", allocationSize = 1)
public class PojoOne extends GenericEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "HB_SEQ_POJO_ONE")
@Column(name = "ID")
@AttributeOverride(name = "id", column = @Column(name = "ID"))
private Integer id;
@Override
public Integer getId() {return id;}
}
我嘗試使用放入系統註釋:@AttributeOverride,@Id, ...但它不起作用。你可以幫我嗎? 我想重寫屬性「id」來指定另一個列名和pojo/table的序列。 這樣做的最好方法是什麼?
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4380 – axtavt