-->
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.  [ 3 posts ] 
Author Message
 Post subject: Save before query
PostPosted: Mon Feb 28, 2011 4:49 pm 
Beginner
Beginner

Joined: Wed Jun 28, 2006 2:24 pm
Posts: 30
Location: Brazil
I have the following scenario:

1. The object X is loaded.

2. Same changes were made in object X.

3. I need to perform a query to validate the object X.

4. If the object X was valiad, then make persistent.

The problem is that when I do the query, the object X is saved. How can I query without save before?


Top
 Profile  
 
 Post subject: Re: Save before query
PostPosted: Tue Mar 01, 2011 7:31 am 
Regular
Regular

Joined: Fri Nov 12, 2010 4:13 am
Posts: 81
Location: India
Can you post your model so it is easy to understand what is the problem

_________________
Thanks & Regards,
Chirag


Top
 Profile  
 
 Post subject: Re: Save before query
PostPosted: Tue Mar 01, 2011 8:47 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Before executing HQL-queries, hibernate flushes the session, so the object is updated within this transaction but not comitted, yet.
You could do your validation in another transaction, but you should probably just rewrite your validation-query, so that it does "recognize" the object X.

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.