-->
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: ILifecycle assumstions
PostPosted: Wed Sep 28, 2005 7:28 am 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
I've a class that looks like this:

Code:
public class Something : ILifeCycle
{
  int idToExtenralResource;

ExtenralResource res;

public ExtenralResource Resource
{
get { return res; }
set { res = value; idToExtenralResource = res.Id; }
}

void ILifeCycle.OnLoad(ISession s, object id)
{
    res = GetExternalResource(idToExternalResource);
}
}


The idToExtenralResource is stored in the table and I need to load that, but it shouldn't be exposed.
It's mapped likethis:

Code:
<property name="idToExtenralResource" access="field" column="res_id"/>



I understand that you shouldn't use the life cycle to load dependant objects via NHib, does the same advice apply to external resources that I'm getting via other means?

Second, I understand that OnUpdate() is not guranteed to be called, which is why I'm using the update on method set.


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.