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

Martin Backhaus (JIRA) noreply at atlassian.com
Mon Jun 2 03:14:34 EDT 2008


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

Martin Backhaus commented on HHH-3317:
--------------------------------------

The hint - flush() - was good.
Now i've got the right problem. Take a look at the stacktrace:

HibernateListener.onPreUpdate(PreUpdateEvent) line: 119	
EntityUpdateAction.preUpdate() line: 221	
EntityUpdateAction.execute() line: 65	
ActionQueue.execute(Executable) line: 279	
ActionQueue.executeActions(List) line: 263	
ActionQueue.executeActions() line: 168	
DefaultFlushEventListener(AbstractFlushingEventListener).performExecutions(EventSource) line: 298	
DefaultFlushEventListener.onFlush(FlushEvent) line: 27	
SessionImpl.flush() line: 1000	

The onPreUpdate() is called within flush(). The now inserted entities need an EXTRA flush().

Don't know if a bug or a feature, but the behavior differs much between oracle and other DBs (MySQL etc.).

> 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