Java Reference
In-Depth Information
public class EmployeeEntityListener {
javax.mail.Session mailSession;
public void prePersist(Employee employee){
System.out.println("The following Employee enity is about to be persisted: "
+ employee.getLast());
// use the mail session
To register this entity listener on the entity, utilize the @EntityListeners annotation on the entity itself, as
@Table(name = "EMPLOYEE")
public class Employee implements Serializable {
Object-relational mapping is a natural way of mapping database tables to Java objects. Coding against Java objects,
rather than writing standard SQL to work with databases, can be beneficial for a number of reasons. Not only does
it make an application easier to maintain, but it also makes it less error prone. The JPA 2.1 release includes some
incremental enhancements that help to make it even more productive and enable even more features, such as the
ability to utilize stored database procedures more easily. Furthermore, schema management has never been easier
than it is now with the new JPA schema generation. Although the JPA 2.1 release is incremental, it brings forth many
improvements that help to solidify object-oriented development for Java Enterprise applications.
Search WWH ::

Custom Search