-->
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.  [ 1 post ] 
Author Message
 Post subject: New father instance using lazy loading
PostPosted: Wed May 31, 2006 3:47 am 
Beginner
Beginner

Joined: Wed May 03, 2006 5:10 am
Posts: 32
Location: Monopoli - Italy
Hello everybody,

I'm using lazy loading and .NET remoting and everything works fine.
..but I have a little question only:

I have a Master - father table and a MasterDetail - child table.
In my remoting environment I have the following methods:

public IList ReconnectSession(ItemBase obj, IList aCollection)
{
try
{
NHibernate.Collection.PersistentCollection tCollection = aCollection as NHibernate.Collection.PersistentCollection;
if (aCollection != null && !NHibernateUtil.IsInitialized(aCollection))
{
openSession();
_session.Lock(obj, LockMode.None);
NHibernateUtil.Initialize(aCollection);
}
}
catch (Exception)
{
throw;
}
finally
{
closeSession();
}

return aCollection;
}

but in the client side, after the execution of reconnectSession method, I need to execute the following piece of code to reassign the father:

foreach (MasterDetail md in MasterDetailsCollection)
{
md.Master = this;
}

this is necessary because when the instance of Master pass through the remoting boundary becomes a NEW istance, different from my old one.

I don't like this way to solve the problem, any suggestions?


Thanks

Antonella :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.