[hibernate-issues] [Hibernate-JIRA] Resolved: (EJB-236) EntityManager Exception when closing transaction (Fetch.LAZY) takes no affect

Emmanuel Bernard (JIRA) noreply at atlassian.com
Fri Oct 6 16:47:25 EDT 2006


     [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-236?page=all ]
     
Emmanuel Bernard resolved EJB-236:
----------------------------------

    Resolution: Cannot Reproduce
     Assign To: Emmanuel Bernard

Your test case is full of missing entities so I wasn't able to run it as is
I did a test reproducing your case though
all entities have a @EmbeddedId
A has a lazy manytoone to B
A has a lazy onetomany to B

load A (which is associated to B1 and B2) and commit does not trigger the exception

I suspect you don't really have Core CR5 and HAN HEM CR3 in your environment.

If you still encounter the issue, please try to do a unit test with 2 or 3 entities max, and few or no properties.

> EntityManager Exception when closing transaction (Fetch.LAZY) takes no affect
> -----------------------------------------------------------------------------
>
>          Key: EJB-236
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-236
>      Project: Hibernate Entity Manager
>         Type: Bug

>  Environment: EntityManager 3.2.0.cr3, Sybase
>     Reporter: Meinolf
>     Assignee: Emmanuel Bernard
>     Priority: Critical
>  Attachments: HibernateEntityManagerTest.java, Tras001.java, Tras001Home.java
>
>
> Hi gurus,
> I just played a little bit arround with the Hibernate Entity Manager and found
> a bug which is nearly similar to a already closed bug:
> http://opensource.atlassian.com/projects/hibernate/browse/EJB-221
> I've done an updated of all jar files of the "fix version/s 3.2.0.cr3 but this didn't help.
> I'm using EntityManager and reading by id a Project object out of the database which
> has a number of oneToMany references within. All references are declared as Fetch.LAZY
> but using hibernates EntityManager does this not take into account.
> When committing the transaction I get an 
> Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.arvato.hibernate.entities.Tras001.tras070 -> com.arvato.hibernate.entities.Tras070
> without saving anything, I do just a simple read?!
> So we've two errors here, 
> 1.	Why are Fetch.LAZY things read by default (Affected: EntityManager with annotation configuration and xml configuration as well)
> 2.	TransientObjectException (Affected: EntityManager with annotation configuration. XML configuration does not throw this but does a read of lazy objects)
> I'll attach the Domain Object and the test class to make some things more clear to you.
> Cheers
> Meinolf
> P.S: There is another bug I found a few days ago regarding a wrong binding order of parameters.
> Can you please take a look at  http://forum.hibernate.org/viewtopic.php?t=965575
> This happens only when using annotation configuration. (Affected: Session and EntityManager)
> Here's the full stack trace:
> javax.persistence.RollbackException: Error while commiting the transaction
>       at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:63)
>       at com.arvato.hibernate.entities.test.HibernateEntityManagerTest.load(HibernateEntityManagerTest.java:71)
>       at com.arvato.hibernate.entities.test.HibernateEntityManagerTest.main(HibernateEntityManagerTest.java:31)
> Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.arvato.hibernate.entities.Tras001.tras070 -> com.arvato.hibernate.entities.Tras070
>       at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:350)
>       at org.hibernate.engine.Cascade.cascade(Cascade.java:139)
>       at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:130)
>       at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:121)
>       at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
>       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
>       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
>       at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
>       at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:53)
>       ... 2 more
> Exception in thread "main" java.lang.IllegalStateException: Transaction not active
>       at org.hibernate.ejb.TransactionImpl.rollback(TransactionImpl.java:74)
>       at com.arvato.hibernate.entities.test.HibernateEntityManagerTest.load(HibernateEntityManagerTest.java:77)
>       at com.arvato.hibernate.entities.test.HibernateEntityManagerTest.main(HibernateEntityManagerTest.java:31)

-- 
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