Hi David

Here's my working CMR code, which is very similar to yours (1-m,
unidirectional).

/**
* @ejb.interface-method
* @ejb.relation
   
*          name="ProjectRequirements"
*          role-name="Owning-Project"
*          target-ejb="RequirementBean"
*          target-role-name="Requirement"
*          target-cascade-delete="yes"
* @jboss.target-relation

*          related-pk-field="ID"
*          fk-column="RQ_ID"
* @jboss.relation-table
*          table-name="T_PROJECTS_REQUIREMENTS"

*          create-table="true"
*          remove-table="true"
*/
public abstract Collection getRequirements();

The bit you seem to be missing is the @jboss.relation-table tag.

Hope this helps.

Edward

On 1/10/03 2:01 pm, "David Nielsen" <[EMAIL PROTECTED]> wrote:

> And if i Use:
> 
> 
> /**
> * @ejb.interface-method
> * @ejb:relation
> *   name="MailMessages-toUser"
> *   role-name="MailMessages-Has-Many_toUsers"
> *   target-ejb="Users"
> *   target-role-name="toUser-belongs_to-MailMessages"
> *   target-cascade-delete="no"
> *   target-mulitple="no"
> * @jboss.target-relation
> *  related-pk-field="messageKey"
> *  fk-column="MESSAGEKEY"
> */
> public abstract Collection getToUsers();
> 
> /** 
> [EMAIL PROTECTED]:interface-method view-type="local"
> */
> public abstract void setToUsers(Collection toUsers);
> 
> jboss complains:
> 
> Unknown column name:USER_KEY
> 
> and if i go to the server.log i see:
> 
> INSERT INTO MAILMESSAGES (messageKey, subject, fromUser, messageType,
> parentMessageKey, projectTaskKey, text, user_key) VALUES (?, ?, ?, ?, ?,
> ?, ?, ?)
> 
> the toUsers column is not present but the user_key which chould be
> toUsers in the table is there ??????????
> 
> 
> What the he..... am i doing wrong ???
> 
> 
> 
> On Wed, 2003-10-01 at 13:42, David Nielsen wrote:
>> I have a problem with my relatonship:
> 
> 
>> 
>> i have a table called MailMessages and a table called Users.
>> 
>> in my MailMessages i have a getToUsers which is a collection of Users
>> which i send messages.
>> 
>> so i created:
>> 
>> /**
>> * @ejb.interface-method
>> * @ejb:relation
>> *   name="MailMessages-toUser"
>> *   role-name="MailMessages-Has-Many_toUsers"
>> *   target-ejb="Users"
>> *   target-role-name="toUser-belongs_to-MailMessages"
>> *   target-cascade-delete="no"
>> *   target-multiple="yes"
>> * @jboss.relation
>> *  fk-column = "toUsers"
>> *  related-pk-field = "user_key"
>> *  fk-constraint = "true"
>> */
>> public abstract Collection getToUsers();
>> /**
>> [EMAIL PROTECTED]:interface-method view-type="local"
>> */
>> public abstract void setToUsers(Collection toUsers);
>> 
>> 
>> but jboos keep saying:
>> 
>> Both roles of a relation-table mapped relationship must have key fields:
>> ejb-relation-name=MailMessages-toUser
>> 
>> dont thay have that ? whats giong wrong
>> 
>> i have a 1-1 relation working, the ony diference i made is that i use a
>> Collection instead of UsersLocal interface
>> 
>> Regard David Nielsen
>> 
>> 
>> 
>> -------------------------------------------------------
>> 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
>> 
> 
> 
> 
> -------------------------------------------------------
> 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



-------------------------------------------------------
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

Reply via email to