1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
@Entity
@Table(name = "person", schema = "test")
public class Person implements java.io.Serializable
{
private static final long serialVersionUID = 1;
private Integer uid;
private String first_name;
private String last_name;
public Person()
{
super();
}
public Person(Integer uid, String first_name, String last_name)
{
super();
this.uid = uid;
this.first_name = first_name;
this.last_name = last_name;
}
@Id
@GeneratedValue
@Column(name = "UID", unique = true, nullable = false, insertable = true, updatable = true)
public Integer getUid()
{
return this.uid;
}
public void setUid(Integer uid)
{
this.uid = uid;
}
...
@PrePersist
public void beforePersist()
{
/*
* Placer ici les affectations automatiques et les contrôles
* Pour annuler la transaction, il suffit de lancer une Exception
*/
}
} |
Partager