-->
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: locking object to session and lazy associations
PostPosted: Sat Mar 01, 2008 5:42 am 
Regular
Regular

Joined: Mon Aug 06, 2007 10:49 am
Posts: 67
Location: Banska Bystrica, Slovakia
Hibernate version:3.2.5

hi,

I have one question about locking object to session. If i lock detached object to session:
session.lock(Object, LockMode.NONE)

hibernate generate select for all many-to-one association mapped lazy=true, cascade='lock', even in case that these association was not initialised (no code hit them).

Is this correct behaviour? should lock operation with LockMode.NONE - just for purpose attaching objects to session - generate sql to hit every lazy many-to-one associated objects?


thnx
peter


Top
 Profile  
 
 Post subject: Re: locking object to session and lazy associations
PostPosted: Sat Mar 01, 2008 5:57 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
Lock is not the intended operation for merging. Why don' t you use merge instead?


Farzad-


Top
 Profile  
 
 Post subject: Re: locking object to session and lazy associations
PostPosted: Mon Mar 03, 2008 4:10 am 
Regular
Regular

Joined: Mon Aug 06, 2007 10:49 am
Posts: 67
Location: Banska Bystrica, Slovakia
farzad wrote:
Lock is not the intended operation for merging. Why don' t you use merge instead?


Farzad-


i don`t want to merge that object , i just want it to attach to the session so i could later call lazy association objects without LazyException. and too many select on lazy associations make application slower.

if i load that object by calling session load or get, database will be hit just once. but i supposed that operation lock should be nice solution for attaching obecjt to session, but it doesn`t look like that.


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.