我在春天的世界很新,我正在学习如何集成Hibernate和Spring框架
我对beetween Hibernate的注解和JPA注释的关系有些献疑。
Whene我有类似如下的实体类:
package org.andrea.myexample.HibernateOnSpring.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/* Classe che rappresenta un oggetto da persistere sul database
*
*/
@Entity
@Table(name="person")
public class Person {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int pid;
private String firstname;
private String lastname;
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
}
那我不理解的事情是什么是Hibernate的注解和JPA注释之间的关系
注释@Entity,@Table(name =“人”),@GeneratedValue( 策略= GenerationType.AUTO)和ID使用先前的例子是简单的JPA注释或特定注释对Hibernate?
如果我使用JPA注释来将数据保存到数据库中,什么给我休眠?
TNX
安德里亚