We're just now getting into using the Value Object functionality.  I
agree, Vincent has done an amazing job with this!

I don't have a fix for your problem, but to save you the trouble in
finding them yourself, I thought I'd note that I've submitted a couple
other areas for Value Objet improvement in the bug tracker:

https://sourceforge.net/tracker/?func=detail&atid=402704&aid=575041&grou
p_id=31602

Basically, the link above talks about the
(1) current inability to code self-referencing relationships (an Entity
can have another Entity of the same type as a parent).
(2) limitations in telling the Value Object (VO) to load "light"
*relationship* VOs when the main "light" VO is requested, and to load
"heavy" relationships when the main "heavy" VO is requested.

I hope we can keep this thread going, because the XDoclet Value Objects
have saved us many many hours...

Matt Vincent
[EMAIL PROTECTED]

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Colin
Daly
Sent: Tuesday, July 09, 2002 7:10 PM
To: xdoclet-user
Subject: [Xdoclet-user] valueobject and bidirectional relationships



Hi all,

i've been playing with the new value objects and i got quite excited
by the new (aggregate/compose) relationship handling (Excellent job
Vincent). We have quite a deep, complicated graph of value objects which
we currently construct and deconstruct manually. The code is thousands
of lines long and is tedious, repetitive and error prone. The value
objects could blow away all of this except for one "little" problem.
They don't seem to handle bi-directional relationships. I tried it and
ended up with StackOverflowExceptions. 
The problem is illustrated in the xdoclet samples themselves - 
the following methods (getCustomerValue() and getAccountValue()) are
from the samples generated source files CustomerCMP and AccountCMP
respectively. There is a 1-N bidirectional aggregate relationship
between Customer and Account. As you can see, there is a problem.
Craig (a colleague) and I have had a chat about the problem and 
there doesn't appear to be any quick fix. Hopefully this mail 
will start a discussion and we will find a solution.

Colin Daly.





    public test.interfaces.CustomerValue getCustomerValue()
    {
         if( CustomerValue == null )
         {
             CustomerValue = new test.interfaces.CustomerValue();
         }
         try
         {
             CustomerValue.setCredit( getCredit() );
             CustomerValue.setId( getId() );
             CustomerValue.setName( getName() );
             CustomerValue.setFirstName( getFirstName() );
             CustomerValue.setPhone( getPhone() );
             CustomerValue.setFax( getFax() );
             java.util.Iterator iAccountView = getAccounts().iterator();
             while (iAccountView.hasNext()){
----->           CustomerValue.addAccountView(
((test.interfaces.AccountLocal)iAccountView.next()).getAccountValue() );
 |           }
 |           CustomerValue.cleanAccountView();
 |           java.util.Iterator iShippingAddressValue =
getShippingAddresses().iterator();
 |           while (iShippingAddressValue.hasNext()){
 |               CustomerValue.addShippingAddressValue(
((test.interfaces.AddressLocal)iShippingAddressValue.next()).getAddressV
alue() );
 |           }
             CustomerValue.cleanShippingAddressValue();
 S           CustomerValue.setVersion(getVersion());
 T       }
 A       catch (Exception e)
 C       {
 K           throw new javax.ejb.EJBException(e);
         }
 O       return CustomerValue;
 V  }
 E
 R
 F  public test.interfaces.AccountValue getAccountValue()
 L   {   
 O       if( AccountValue == null )
 W       {
            AccountValue = new test.interfaces.AccountValue();
 |       }
 |       try
 |       {
 |           AccountValue.setBalance( getBalance() );
 |           AccountValue.setId( getId() );
 |           if ( getOwner() != null )
----->
AccountValue.setOwnerNormalValue(getOwner().getCustomerValue() );
        }
        catch (Exception e)
        {
            throw new javax.ejb.EJBException(e);
        }
        return AccountValue;
    }






-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Stuff, things, and much much more.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Stuff, things, and much much more.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to