Community
Participate
Working Groups
Build Identifier: Situation: - The whole domain model is defined in the orm.xml file. All entities are simple POJOs (no jpa annotations are used at all). - All entities extend a base entity declared in the orm.xml using <mapped-superclass ..> Problem: Adding event declarations (pre-persist, pre-update ..) into orm.xml to the mapped-superclass does not bring any effect. These declarations seem to be ignored. Example: public abstract class BaseEntity { private Timestamp insertTimestamp; private Timestamp lastUpdateTimestamp; public void onPersist() { ... } public void onUpdate() { ... } } <mapped-superclass class="com.my.model.BaseEntity"> <pre-persist method-name="onPersist"/> <pre-update method-name="onUpdate"/> <post-load method-name="postLoad"/> </mapped-superclass> Replacing the xml definitions with annotations (@PreUpdate, @PrePersist, ..) directly in the BaseEntity class solves the problem. Also moving the xml declarations from the superclass to the subclass solved the problem. It look like the bug while the parsing/mapping the <mapped-superclass> XML declaration. Event declarations seem to be ignored / don't work. The annotation-based equivalent seems to work correctly. I'm using EclipseLink 2.2.0 with H2 in the SE environment developing under MacOs+IntelliJ Reproducible: Always Steps to Reproduce: 1. Create an entity class and declare as entity using orm.xml 2. Create a superclass for the created entity class and declare in orm.xml using <mapped-superclass> 3. Add <pre-persist> and/or <pre-update> to the superclass in the orm.xml 4. Persist and/or update the entity and check wether the events method in the base class are being called.
Created attachment 197719 [details] Proposed changes
Changes submitted. Verified by: Tom Ware Tests: Modified existing test (testCreateBeerConsumer) from EntityMappingsInheritedJUnitTestCase.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink