[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2765) nonthreadsafe exception in a case where I have only the main thread

Zied Hamdi (JIRA) noreply at atlassian.com
Thu Aug 2 11:37:11 EDT 2007


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

Zied Hamdi commented on HHH-2765:
---------------------------------

Hi Again,

I forgot to tell you how to run the example. If you run it with the line
<!-- <property name="hibernate.hbm2ddl.auto" value="create" />  --> 
uncommented, you'll NOT get the exception: on em closing, the schema is generated again (before the second save() in JPAMain). I didn't look further why it happens...

First I uncoment the line to create the database. Then I comment it back, and run main again on an empty db. That way tables are not dumped between the two calls.

Regards,
Zied 

> nonthreadsafe exception in a case where I have only the main thread
> -------------------------------------------------------------------
>
>                 Key: HHH-2765
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2765
>             Project: Hibernate3
>          Issue Type: Bug
>    Affects Versions: 3.2.3
>         Environment: JPA
> Hibernate 3.2.3.GA
> Derby 10.2.2.0
>            Reporter: Zied Hamdi
>            Priority: Blocker
>         Attachments: 20070802-161806 IntoJPA bug report.zip
>
>   Original Estimate: 5 days
>  Remaining Estimate: 5 days
>
> I think it's because I do a EntityManager.clear() inside a @PreUpdate listener. But it doesn't really seam forbidden to me since em.merge can be executed on unattached objects.
> I zipped all the source code, JPAMain.main() is my test case. Even though more classes are implied, I've attempted to make the code as small as possible (for what I'm trying to do).
> I'll help you evolve in this bug as I can, it is really blocking to me :-/
> There's an explanation of what I'm trying to do at http://forum.hibernate.org/viewtopic.php?p=2361052#2361052
> here's the stack trace
> Hibernate: update Person set startDate=?, endDate=?, note=?, lastOccurence=? where id=? and revision=?
> 2007-08-02 15:20:03,171 [main] ERROR org.hibernate.AssertionFailure.<init>(22) - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
> org.hibernate.AssertionFailure: possible nonthreadsafe access to session
> 	at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:107)
> 	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
> 	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
> 	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
> 	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
> 	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
> 	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:54)
> 	at main.JPAMain.save(JPAMain.java:46)
> 	at main.JPAMain.main(JPAMain.java:19)
> javax.persistence.RollbackException: Error while commiting the transaction
> 	at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)
> 	at main.JPAMain.save(JPAMain.java:46)
> 	at main.JPAMain.main(JPAMain.java:19)
> Caused by: org.hibernate.AssertionFailure: possible nonthreadsafe access to session
> 	at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:107)
> 	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
> 	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
> 	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
> 	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
> 	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
> 	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:54)
> 	... 2 more
> 2007-08-02 15:20:03,203 [main] INFO  org.hibernate.impl.SessionFactoryImpl.close(769) - closing
> 2007-08-02 15:20:03,203 [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider.close(147) - cleaning up connection pool: jdbc:derby://localhost:1527/sample

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