当前位置: 代码迷 >> J2EE >> hibernate注解的有关问题
  详细解决方案

hibernate注解的有关问题

热度:85   发布时间:2016-04-22 02:04:11.0
hibernate注解的问题
JPA的注解功能太少,hibernate那些独有的都没有。
我用hibernate的@entity发现怎么也不行,不自动生成表,用JPA的entity就行。能混合着用么?

Java code
//optimisticLock 这属性只有hibernate有,fetch也是,怎么能同时使用啊??@javax.persistence.Entity@org.hibernate.annotations.Entity(optimisticLock = OptimisticLockType.VERSION) @javax.persistence.Table(name = "TB_CUSTOMER", schema = "PBUSER")@org.hibernate.annotations.Table(appliesTo = "cc", fetch = FetchMode.SELECT)public class Customer {    private int id;    @GeneratedValue    @Id    public int getId() {        return id;    }    public void setId(int id) {        this.id = id;    }}




------解决方案--------------------
jpa是标准的API,是JDK本身提供的~!hibernate在jpa 的基础上进行了扩展!不知道Eclipse插件在生成表的时候具体使用的是哪个!我觉得应该是JPA的~
  相关解决方案