[
http://opensource.atlassian.com/projects/hibernate/browse/EJB-342?page=co...
]
Emmanuel Bernard resolved EJB-342.
----------------------------------
Resolution: Cannot Reproduce
Your test is flawed.
You try to persist() an already managed entity, this is a no op and must not call the
prePersist method as the entity is not persisted again.
Note that when I test the insertion of a new entity, the prePersist method is called.
Hibernate behave correctly. Hopefully the other providers behave accordingly.
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
Fix For: 3.3.2.GA
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