且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么JPA和休眠都有"实体QUOT;和"表"注解?

更新时间:2022-10-17 20:39:23

org.hibernate.annotations.Entity与休眠功能扩展javax.persistence.Entity。

看:的http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/annotations/Entity.html

I use hibernate 3.6, and found there are such annotations:

javax.persistence.Entity
org.hibernate.annotations.Entity

javax.persistence.Table
org.hibernate.annotations.Table

Why hibernate provides its own? Is it a replacement of jpa one, or just a complement? Should(Can) I use them both together, like:

@javax.persistence.Entity
@org.hibernate.annotations.Entity
public class User {}

org.hibernate.annotations.Entity extends javax.persistence.Entity with hibernate features.

see: http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/annotations/Entity.html