org.hibernate.annotations.Entity和javax.persistence.Entity 区别
来源:互联网 发布:现在淘宝开店步骤 编辑:程序博客网 时间:2024/05/22 13:05
在@Entity时很容易顺手导入@org.hibernate.annotations.Entity这个包,结果导致了异常。其实应该导入的是@javax.persistence.Entity
Always import @javax.persistence.Entity
@org.hibernate.annotations.Entity是@javax.persistence.Entity的一个补充,但不是后者的替代品
如果import @org.hibernate.annotations.Entity的话,会报异常。
如果想使用@org.hibernate.annotations.Entity所包含的特殊的功能的话,需要在import @javax.persistence.Entity的基础上增加注释,如下:
- @Entity
- @org.hibernate.annotations.Entity(optimisticLock=OptimisticLockType.ALL)
- public class MyEntity implements Serializable {
- ...
- }
0 0
- javax.persistence.Entity和org.hibernate.annotations.Entity的区别
- org.hibernate.annotations.Entity和javax.persistence.Entity 区别
- org.hibernate.annotations.Entity和javax.persistence.Entity区别、使用
- org.hibernate.annotations.Entity和javax.persistence.Entity 区别
- org.hibernate.annotations.Entity和javax.persistence.Entity
- import javax.persistence.Entity; 与import org.hibernate.annotations.Entity; 在Spring注解中
- import javax.persistence.Entity;
- java.lang.NoClassDefFoundError: org/hibernate/annotations/Entity
- Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.Entity
- Hibernate Entity / Persistence LifeCycle States
- java.lang.NoClassDefFoundError: javax/persistence/Entity
- java.lang.ClassNotFoundException: javax.persistence.Entity
- java.lang.ClassNotFoundException: javax.persistence.Entity
- Type mismatch: cannot convert from org.hibernate.annotations.CascadeType to javax.persistence.Cascad
- Spring整合Hibernate时出现如下错误Caused by: java.lang.NoClassDefFoundError: javax/persistence/Entity
- hibernate使用import javax.persistence.Entity是@符号不给提示
- spring 整合hibernate Caused by: java.lang.ClassNotFoundException: javax.persistence.Entity
- hibernate annotations @Entity hql "XX not mapped"
- 设计模式--模板方法模式
- 英文投稿的一点经验【转载】
- 2014.4.8 今天主要是聊天室
- java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking
- 常用背包小结
- org.hibernate.annotations.Entity和javax.persistence.Entity 区别
- 动态规划练习题
- 题目1139:最大子矩阵
- linux多线程 pthread_cond_wait() 函数
- 丁俊晖夺冠身价猛增 单赛季5冠“台球皇帝”亨德利
- fork与行缓冲
- Service Unavailable 错误应用程序名称: w3wp.exe 错误模块名称: KERNELBASE.dll
- Matlab 点滴
- 软件界面设计