[
http://opensource.atlassian.com/projects/hibernate/browse/EJB-342?page=co...
]
Adam Hardy updated EJB-342:
---------------------------
Attachment: bugtest.zip
Here it is, not sure what build system you prefer so I zipped up all the dependencies into
the directory target/dependency.
It uses derby db, so the test (src/test/java/org/permacode/BugTest.java) will:
create a db with a table
insert a row of data
launch entityManagerFactory
run query to fetch entity mapped to table
change a property on the entity
persist it
test if the modified date (on the superclass) was changed by the callback.
event listener (prepersist, preinsert) not firing
--------------------------------------------------
Key: EJB-342
URL:
http://opensource.atlassian.com/projects/hibernate/browse/EJB-342
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.1.GA
Environment: jdk1.5.0_12, linux 2.6
Reporter: Adam Hardy
Attachments: bugtest.zip
I have a superclass with several properties, including 'modified', a datetime
field which a prepersistlistener should update.
All my entities inherit this superclass.
The superclass is mapped with the appropriate prepersist listener identifying the
callback method to call.
<mapped-superclass class="org.permacode.atomic.domain.AtomicEntity"
access="FIELD">
<pre-persist method-name="prePersistCallBack" />
<attributes>
<basic name="ownerId">
<column name="OWNER_ID" />
</basic>
<basic name="created">
<column name="CREATED" />
<temporal>DATE</temporal>
</basic>
<basic name="modified">
<column name="MODIFIED" />
<temporal>DATE</temporal>
</basic>
<version name="version">
<column name="VERSION" />
</version>
</attributes>
</mapped-superclass>
The method prePersistCallBack() is on the superclass:
public void prePersistCallBack()
{
this.modified = new Date();
logger.info("doing prePersistCallBack() - " + this + " -
modified="
+ this.modified);
}
I see no logging and I see the SQL statement contains the untouched modified value.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira