-->
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: Prevent Flushing from Queries - Explicit to Session.persist
PostPosted: Thu May 19, 2005 2:45 pm 
Newbie

Joined: Tue Nov 25, 2003 4:31 pm
Posts: 12
Location: Minnesota
I'm wondernig what needs to be set in order to prevent flushing all queried objects when I only want to explicitly persist one.

My Hibernate Config/Mapping files do not have any cache entries.

Code:
SmoHeader hdr = (SmoHeader) q.iterate().next();
SmoHeaderId id = hdr.getId();
Transaction tx = s.beginTransaction();
hdr = (SmoHeader) s.get(SmoHeader.class, id);
hdr.setProfileCreated("JAKEHJ");
s.save(hdr);
tx.commit();


At the time of commit, all items returned from the query (q) are updated back to the database. I only want the s.save(hdr) to cause a single update at tx.commit()

Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 19, 2005 4:05 pm 
Newbie

Joined: Tue Nov 25, 2003 4:31 pm
Posts: 12
Location: Minnesota
Nevermind, it was a problem with my MoneyUserType and deepCopy, so every flush was saying the Order Total was dirty (a Money object).

But, is the expected behavior that if an object is fetched in a read only query, that all other pointers to that object can never be modified?
    * Object A is returned in a Read-Only Query.
    * In the same session, Find Object B by same ID as Object A
    * Object A == Object B
    * Modify Object B and persist
    * Object B will NOT be persisted


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.