was anyone able to create an unidirectional 1:1 CMR with an according field in the value object?
I couldn't find any working example (I'm new to XDoclet, but I could already make an unidirectional 1:n CMR work - even I had to exchange the generated <key-fields/> nodes within jbosscmp-jdbc.xml from ONE to MANY side and the other way around).
The relation should be as follows:
User (PK: User.id) ----(1:1)----> Account (FK: Account.user_id_fk)
Here's the (latest) XDoclet code I tried:
In UserEJB class:
* @ejb.transaction type = "supports"
* compose = ".AccountValue"
* compose-name = "AccountView"
* members = ".AccountLocal"
* members-name = "Account"
* relation = "external"
* name = "user-account"
* role-name = "user-has-account"
* target-ejb = "Account"
* target-role-name = "account-belongs-to-user"
* target-cascade-delete = "true"
* fk-constraint = "true"
* related-pk-field = "id"
* fk-column = "user_id_fk"
public abstract AccountLocal getAccount();
public abstract void setAccount(AccountLocal accounts);
The XDoclet generation succeeds but the UserCMP class contains errors.
I also tried out other 'combinations' of the tags, but either the XDoclet generation fails or the generated code contains errors.
When I ommit the 'compose/compose-name' attributes in '@ejb.value-object' tag (I think it's used only? for 1:n CMRs - am I right?) the type of the account field within UserValue class is AccountLocal (I would expect the type AccountValue) and the UserData class contains errors.
So I'm really helpless - I could change the generated code until it would work - but I think that's not the intention of XDoclet.
I'm using XDoclet 1.2b2 and JBoss 3.0.4
Would be nice if someone could help...
Thanks in advance,