-->
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: Debugging hibernate
PostPosted: Mon Jan 14, 2008 6:30 pm 
Beginner
Beginner

Joined: Thu Nov 02, 2006 2:23 pm
Posts: 33
Hey,

i work with Ejb3 (jboss + hibernate).
i get an excpetion when i tried to execute query because hibernate execute flush before the query and in the flush it complained that it try to persist deleted object. (i dont get any furher information)
I debug my code and i dont call to any persist during this sequence (there is also no case of changes that can cause to cascade).

I have JAD plugin in my eclipse and i put a breakpoint in the hibernate class , but it didnt stop.

Please help me to think on any idea to understand which object it try to persist.

ps. hibernate trace didnt help.
Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 14, 2008 9:32 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
avihaimar,

I can only suggest generalities without knowing the code in depth, but this migh help somehow:

- it makes sense that Hibernate perfoms a flush before a query, even if you didn't call it explicitly, because Hibernate promises to always return fresh data on a query.list();

- remember that Hibernate generates class proxies, therefore a breakpoint on a class won't necessarily be hit. Use logging instead. It is less gramorous, but more reliable.

- your code should not depend on a session to be flushed or not for Hibernate to "realize" an object has been deleted. Remember that, unless you flush and commit every step of the way (unlikely in a managed environment), Hibernate performs the database operations in a fixed sequence according to the type of SQL operation (see documentation 10.10: flushing the session)

_________________
Gonzalo Díaz


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.