|
|
|
|
Re: Persistence: loading whole object before adding it [message #712643 is a reply to message #712627] |
Sun, 07 August 2011 14:40 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Martin,
Comments below.
On 07/08/2011 7:20 AM, Martin odlouck wrote:
> Thank your for quick response. I see what are you traying to tell me.
> My model is rather specific so I try to create simplier example. Let's
> suppose object A is a student and B is a students club. Every student
> has a reference to the university he/she attands. When calling
> club.getStudents().add(student), the club needs to check
> student.getUniversity().getName() to assign him responsibilities (for
> example).
I would have imagined the assignment of responsibilities are themselves
serialized and are set appropriately based on that persisted information.
> If student's university is NULL the club does not know what to do with
> him.
Suppose he was expelled? How should the model update? Suppose he
transfers to a different university. Should he be removed from the club
too?
> So what si the best solution in such a case? The clubs accesses the
> student's reference to university immediately after addition.
If you serialize universities before students in a single resource (it's
bad news to resolve proxies to university during loading if they are in
a different resource) and serialize the student's reference to the
university before that of their references to clubs, that will help;
these can be controlled with the order at the root of the resource of
the feature order in the classes.
> However, the university reference is loaded later.
Is that because of feature order in the class?
Without all the details of what are containment references, how many
resources are involved, and so on, it's very hard to give specific
answers. One thing is for sure though, these order dependencies of what
must be set first are problematic from all aspects. Even when working
with the API, it will be necessary to assign the university before
assigning club; who's to know that just looking at the API...
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03117 seconds