I am quite new in Spring world and I am studying how to integrate Hibernate and Spring framework
i have some dount about the relation beetween Hibernate annotation and JPA annotation.
Whene I have something like the following entity class:
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;
}
}
The thing that I am not understanding is what is the relationship between Hibernate annotation and JPA annotation
The annotation @Entity, @Table(name="person"), @GeneratedValue(strategy=GenerationType.AUTO) and id using in the previous example are simple JPA annotation or specific annotation for Hibernate?
if I'm using JPA annotations to persist the data to the database, what's giving me Hibernate?
Tnx
Andrea
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…