Patches item #583313, was opened at 2002-07-18 07:07
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402706&aid=583313&group_id=31602

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew H. Barkley (andrew_barkley)
Assigned to: Nobody/Anonymous (nobody)
Summary: Value object bidirectional relationships

Initial Comment:
I have a solution to the bidirectional relationships  problem. The 
fundamental problem is the recurrence of get*Value() calls 
between arbitrary beans.  This cycle can get  very complex, so you 
can't simply rely on a solution that fixes  the problem between just 
two beans.

The solution is to maintain a simple database-
like cache of the  constructed value objects.  The cache can be a 
simple object,  such as a Map.  The Map would be keyed by entity 
name to another  Map, that would then be keyed by primary key to a 
value object.

When a get*Value() method is called for an 
entity bean, it will  first try to retrieve its value object from the cache.  If 
not  present, the value object will be created and stored in the  cache.  
The value object will then
be returned.

The simplest 
means of creating and maintaining this cache would  is to add a 
get*Value(Map) method for every existing get*Value()  method.  
The get*Value() method will simply instantiate the Map,  and 
delegate to
get*Value(Map).  The get*Value(Map) method will  
then perform mostly the same logic that is currently in  get*Value(), 
wrapped with the cache lookup. However, it must  use the 
get*Value(Map) methods of other beans, rather than the  cache-
less versions.  After the whole graph of value objects is created, the 
cache will simply go out of scope and be garbage  
collected.

This solution does not rely on maintaining state 
within beans about value objects and is fully serializable, so it will 
even be stable for remote relationships (remote 
entities).

The disadvantage is in the added maintenance of 
now a pair of getters for every value object.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402706&aid=583313&group_id=31602


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to