java

位置:IT落伍者 >> java >> 浏览文章

JPA和hibernate对删除操作的不同[3]


发布日期:2019年04月06日
 
JPA和hibernate对删除操作的不同[3]

人员的实体对象

/*

* To change this template choose Tools | Templates

* and open the template in the editor

*/

package comhadesleejpaentity;

import javaioSerializable;

import javaxpersistenceEntity;

import javaxpersistenceGeneratedValue;

import javaxpersistenceGenerationType;

import javaxpersistenceId;

import javaxpersistenceManyToOne;

import javaxpersistenceTable;

/**

*

* @author hadeslee

*/

@Entity

@Table(name = JPAPerson)

public class Person implements Serializable {

private static final long serialVersionUID = L;

@Id

@GeneratedValue(strategy = GenerationTypeAUTO)

private Integer id;

private String name;

private int age;

@ManyToOne

private Department department;

public int getAge() {

return age;

}

public void setAge(int age) {

thisage = age;

}

public Department getDepartment() {

return department;

}

public void setDepartment(Department department) {

thisdepartment = department;

}

public String getName() {

return name;

}

public void setName(String name) {

thisname = name;

}

[] [] [] [] []

               

上一篇:JPA和hibernate对删除操作的不同[4]

下一篇:JPA和hibernate对删除操作的不同[2]