Hi,
Here is the example :
public java.lang.Object ejbCreate( Customer Client,
Date OrderDate,
String OrderReference)
throws CreateException
{
try {
setOrderDate (OrderDate); // Simple CMP field
setOrderReference (OrderReference); // Simple CMP field
setCustomerId (Client.getId()); // CMP field for foreign key
} catch(Exception e) {
...
}
return null;
}
public java.lang.Object ejbPostCreate( Customer Client,
Date OrderDate,
String OrderReference)
throws CreateException
{
try {
setCustomer(Client); // Sets the CMR field
} catch(Exception e) {
....
}
}
Here is the CMP field for the foreign key
/**
* @ejb.persistence column-name = "CUSTOMER_ID"
* @ejb.interface-method
*/
public abstract Long getCustomerId();
/**
* @ejb.interface-method
*/
public abstract void setCustomerId(Long val);
And the corresponding CMR field
/**
* @ejb.interface-method
* @ejb:transaction type="Required"
* @ejb:relation
* name="Order-Customer"
* role-name="Order-have-Customer"
* target-ejb="PhML_Customer"
* @jboss:relation
* fk-column = "CUSTOMER_ID"
* related-pk-field = "customerId"
*/
public abstract PharmaML_EJB.interfaces.Customer getCustomer();
/**
* @ejb.interface-method
*/
public abstract void setCustomer(PharmaML_EJB.interfaces.Customer arg);
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3823617#3823617
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3823617
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user