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

Gail Badner (JIRA) noreply at atlassian.com
Fri May 30 13:51:35 EDT 2008


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

Gail Badner commented on HHH-3317:
----------------------------------

When a sequence is used to generate IDs, the entity is not inserted until the session is flushed.

Have you tried flushing the session using Session.flush()? Also, unless you are using FlushMode.MANUAL (or the deprecated FlushMode.NEVER), the session will automatically be flushed when the transaction is committed.

Please close this issue if you find that flushing the session inserts the entity; otherwise, please attach a test case that reproduces this issue.

> 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: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.6
>         Environment: hibernate3.2.6.ga.jar, Oracle 10
>            Reporter: Martin Backhaus
>            Priority: Minor
>
> 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