Oh, yeah - one more part to this. The xdoclet tags I reference in the mail archive has one bug. On the getParent() method, the @ejb.relation tag needs to also have target-multiple="yes" to work with latest xdoclet cvs.
David -- David Ward wrote: > Andreas, > > Don't think children and parent, or even just children. Only think > about parent, as that's all you really need! > > For more details, carefully read this URL: > http://sourceforge.net/mailarchive/message.php?msg_id=1873809 > > Searching the lists is always a good thing to try. > > Hope this helps, > David :) > > -- > > Andreas Leitner wrote: > >> Hi, >> >> I am using xdoclet cvs (as of today). I am trying to model a tree >> relation using CMR and Value Objects. But I cannot get it to work. >> Maybe some enlightened soul on this list can shed some light on this >> issue? Help will be very much appreciated. >> >> Here is what I want to model: >> I have a bean Account, which has zero or more child-accounts. >> >> What do I want to have: >> If I read the recent posts on the issue correctly, I want 'compose' >> semantic. Because when I create a whole account-sub-tree on the client >> side (using value objects), I the client should only tell the server >> to add the root node, all other nodes would be added indirectly by the >> server. >> >> Now, I have experimented quite a lot with different attributes and >> constelations, here is my best guess ATM: >> >> /** >> * get child Accounts >> * * @ejb.interface-method view-type="local" >> * * @ejb.relation name="Account-Account" >> * role-name="One parent Account has multiple child >> Accounts" >> * * @jboss.target-relation fk-column="AccountId_fk" >> * related-pk-field="id" >> * * @ejb.value-object >> * >> compose="com.vescon.aum.common.valueobject.masterdata.AccountValue" >> * compose-name="ChildAccounts" >> * match="*" >> * >> members="com.vescon.aum.server.iface.masterdata.AccountLocal" >> * members-name="Account" >> * relation="external" >> * type="Collection" >> * **/ >> public abstract Collection getChildAccounts(); >> >> /** >> * set related Addresses >> * >> * @ejb.interface-method view-type="local" >> **/ >> public abstract void setChildAccounts(Collection childAccounts); >> >> >> /** >> * get parent Account >> * * @ejb.interface-method view-type="local" >> * @ejb.relation name="Account-Account" >> * role-name="One child Account has one parent Accounts" >> * cascade-delete="yes" >> * * @jboss.relation fk-column="AccountId_fk" >> * related-pk-field="id" >> * * @ejb.value-object >> * match="*" >> * relation="external" >> * * @jboss.not-persisted-field >> * **/ >> public abstract AccountLocal getParentAccount(); >> >> /** >> * get parent Account >> * * @ejb.interface-method view-type="local" >> **/ >> public abstract void setParentAccount(AccountLocal parentAccount); >> >> >> Then all compiles, but the AccountValue is missing the feature >> 'getParentAccount ()'. >> When I change the 'one-side' of the relation to: >> >> /** >> * get parent Account >> * * @ejb.interface-method view-type="local" >> * @ejb.relation name="Account-Account" >> * role-name="One child Account has one parent Accounts" >> * cascade-delete="yes" >> * * @jboss.relation fk-column="AccountId_fk" >> * related-pk-field="id" >> * * @ejb.value-object >> * >> compose="com.vescon.aum.common.valueobject.masterdata.AccountValue" >> * compose-name="AccountValue" >> * match="*" >> * relation="external" >> * * @jboss.not-persisted-field >> * **/ >> public abstract AccountLocal getParentAccount(); >> >> I do get the missing 'getParrentAccount ()', but it returns an >> 'AccountLocal' instead of an 'AccountValue', which is totaly useless >> on the client side of course. >> >> Does anybody know how I can get out of this dillema? >> >> many thanks in advance, >> Andreas >> PS: I can post more details if needed >> >> > -- --------------------- David Ward [EMAIL PROTECTED] http://www.dotech.com ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
