]
HG commented on HHH-3317:
-------------------------
I had the same problem and was able to solve it using Listeners. I describe this in my
blog at
. Let me know in case you have any doubts which I can clarify after reading the post.
Entities saved within onPreUpdate() never inserted into db when id
generator is sequenze (f.e. oracle)
------------------------------------------------------------------------------------------------------
Key: HHH-3317
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3317
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: hibernate3.2.6.ga.jar, Oracle 10
Reporter: Martin Backhaus
Priority: Minor
Attachments: HHH_3317.hbm.xml, HHH_3317_Test.java
If you save (insert) a entity within the event preUpdate and the id is a oracle-sequenze,
hibernate put the entity to insert in the session-ActionQueue, BUT NEVER INSERTS it. If
you use mysql/hsql... where the id is differently generated, the insert happens
immediately and no put to the ActionQueue occures.
As workaround you can queue the object (to insert) yourself and call save() within the
postUpdate-Event.
I use this events for historizing some stuff.
Inserts within onDelete() works fine.
the ids are annotated as shown here:
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected Long id = null;
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: