-->
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.  [ 5 posts ] 
Author Message
 Post subject: Load: Order of object-instantiation (many-to-one)
PostPosted: Tue Feb 27, 2007 4:44 am 
Newbie

Joined: Tue Feb 27, 2007 3:23 am
Posts: 3
Hi,

Problem description:
we have a class A, which has a member of class B. The mapping is set to an many-to-one-relation. At the loading-process before A is loaded a new B-Object is created. Unfortunately the B-Object (member of A) is at that moment NOT fully loaded (members of B not loaded). When the membervariable of the A-object is set with the B-object, then B is not completely loaded and we have not all required information. It is important, that we have at the point a complete object.

Question:
How can I achieve, that a member of a class is fully loaded at the moment it is set !? Can I influence NHibernates behaviour ?

greetings

Sebastian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 27, 2007 7:37 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
AFAIK You should never assume any given load order of objects/proeprties.

If You proeprty setters need another properties, You should use some other acces strategy in NHibernate: like some nosetter.

Or make the property setter private/protected and allow changes from outside trought some extra method.

Gert

_________________
If a reply helps You, rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 3:31 am 
Newbie

Joined: Tue Feb 27, 2007 3:23 am
Posts: 3
The problem is that the properties are something like "pseudo members"! The set/get-methods of the property propagates the given value to another storage. So it is necessary that the given value of the property (at loading time) is fully instantiated at that time!

Any suggestions?

greetings

Sebastian


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 3:50 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
tmp wrote:
The problem is that the properties are something like "pseudo members"! The set/get-methods of the property propagates the given value to another storage. So it is necessary that the given value of the property (at loading time) is fully instantiated at that time!

Do not map those properties - they are already mapped trougth another class.

Gert

_________________
If a reply helps You, rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 4:24 am 
Newbie

Joined: Tue Feb 27, 2007 3:23 am
Posts: 3
Ok...some more details:

We use an managed layer (managed C++) for persistence for an unnanaged application (C++). The persistence layer is something like a api and there is no data stored. A run looks like this:

1. get data from the unnmanaged part
2. convert data into managed objects
3. save the data via properties with hibernate
// load ->
4. get managed data from hibernate via properties
5. convert data into unmanaged data
6. set unmanaged data

So the properties are responsible for the transfer unnmanaged <-> managed and contains NO membervariables. When data is set via a property then it is necessary that the given value (managed object) is fully loaded, because after the setting of the property the context between managed<->unmanaged object is lost.

I hope somebody undestand this structure & problem :-)

greetings


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.