【发布时间】:2011-09-03 18:40:27
【问题描述】:
我想在自定义类中包装 id。像这样
@Entity
@Table(name = "USERS")
public class User {
@EmbeddedId
UserId id;
}
@Embeddable
public class UserId implements Serializable {
private Long value;
}
value 自动生成 UserId 的问题。我应该怎么做才能使value 上的@GeneratedValue 可行?
顺便说一句,如果id 能够自动初始化就太好了。
【问题讨论】:
标签: java hibernate domain-driven-design identity