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()).getAddressValue() ); | } 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 Oh, it's good to be a geek. http://thinkgeek.com/sf _______________________________________________ Xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel