-->
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: Illegal attempt to associate a collection with two open sess
PostPosted: Mon Oct 25, 2010 4:36 pm 
Newbie

Joined: Thu Oct 21, 2010 3:03 pm
Posts: 5
Location: India
Illegal attempt to associate a collection with two open sessions.

These are my tables:
Users -
UserId, StateId, CityId (StateId > States.StateId, CityId > Cities.CityId)

States -
StateId, StateName

Cities -
CityId, StateId, CityName (StateId > States.StateId)

//Code
UsersRepo rUser = new UserRepo();
rUser.State = rStateRepo.Load<State>(1);
rUser.City = rCityRepo.Load<City>(1);

This does not work, am i using sessions in wrong way.???

_________________
No one will manufacture a lock without key, similarly god will never give problems without a solution.


Top
 Profile  
 
 Post subject: Re: Illegal attempt to associate a collection with two open sess
PostPosted: Fri Nov 12, 2010 5:01 pm 
Newbie

Joined: Thu Mar 12, 2009 11:54 pm
Posts: 3
Location: India
what is lazy setting between city and state?
this exception is thrown when you try to load a same object twice in same session, and if you have lazy="false" then when you load the state cities will be automatically gets fetched. Then i your case cities are getting loaded twice.


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.