-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: AssertionFailure
PostPosted: Fri Jan 27, 2006 11:04 am 
Newbie

Joined: Tue Oct 19, 2004 4:18 am
Posts: 9
Avec Hibernate 3.0, le code suivant :

Code:
Session session = sessionFactory.openSession();
tx = session.beginTransaction();
Dog dog = new Dog("Zeus");
session.save(dog);         
session.evict(dog);         
dog.setName("Apollo");                  
tx.commit();         


Génère une AssertionFailure :

Code:
15:33:21,519 ERROR AssertionFailure: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
...


Même le code peut paraître êtrange, Est-ce normal ?

_________________
Nicolas Brasseur - Loop Factory - http://www.loop.be


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 9:41 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
pourquoi tu sort le object de la session et essaye de le changer après? Le changement suivant va marcher.

Code:
tx = session.beginTransaction();
Dog dog = new Dog("Zeus");
session.save(dog);         
//session.evict(dog);         
dog.setName("Apollo");                 
tx.commit();


Regards Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.