Defining Entity Listener Class Via @EntityListeners
Description: This application is a sample of using the JPA @MappedSuperclass and @EntityListeners with JPA callbacks.
Key points:
- the base class ,
Book, is not an entity, it can beabstract, and is annotated with@MappedSuperclassand@EntityListeners(BookListener.class) BookListenerdefines JPA callbacks (e.g.,@PrePersist)- subclasses of the base class are mapped in tables that contains columns for the inherited attributes and for their own attibutes
- when any entity that is a subclass of
Bookis persisted, loaded, updated, etc the corresponding JPA callbacks are called

