[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3317) Entities saved within onPreUpdate() never inserted into db when id generator is sequenze (f.e. oracle)

HG (JIRA) noreply at atlassian.com
Sun Nov 21 16:40:13 EST 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39182#action_39182 ] 

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 http://anshuiitk.blogspot.com/2010/11/hibernate-pre-database-opertaion-event.html . 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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list