org.hibernate.annotations.Entity具有一些
javax.persistence.Entity尚未标准化的额外属性。仅当
AnnotationConfiguration直接使用hibernate
或JPA提供程序为hibernate时,这些附加功能才有效。
从 常见问题解答: 编辑: 编辑: 新建链接答案:
新建链接特定问题:
我使用@ org.hibernate.annotations.Entity并获得未知实体异常
始终导入@ javax.persistence.Entity
@ org.hibernate.annotations.Entity完成@ javax.persistence.Entity,但不能替代
例如,有一个名为的属性
optimisticLock,该属性告诉hibernate 在更新时是使用标准 版本列
还是比较所有列。此行为不在JPA规范中,因此为了对其进行配置,必须使用在其自己的注释中找到的特定于hibernate的扩展。
像这样:
@Entity@org.hibernate.annotations.Entity(optimisticLock=OptimisticLockType.ALL)public class MyEntity implements Serializable {...}


