在hibernate裡面調用session的delete方法以後
測試時候使用的兩個類分別如下
舉的例子是部門和員工的關系
部門的實體對象
/*
* To change this template
* and open the template in the editor
*/
package com
import java
import java
import java
import javax
import javax
import javax
import javax
import javax
import javax
/**
*
* @author hadeslee
*/
@Entity
@Table(name =
public class Department implements Serializable {
private static final long serialVersionUID =
@Id
@GeneratedValue(strategy = GenerationType
private Long id;
@OneToMany(mappedBy =
private Set<Person> persons = new HashSet<Person>();
private String deptName;
private String description;
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this
}
public String getDescription() {
return description;
}
[
From:http://tw.wingwit.com/Article/program/Java/ky/201311/29049.html