I have a question on select primary key. I have a entity bean called Customer and another called Order. They have their own primary key: customerId for Customer and orderId for Order. One Customer may have many Orders. I'm using CMR, so they are jared together. When I specified <primkey-field> with different cmp field (customerId for Customer and orderId for Order) in ejb-jar.xml I got following error when I try to put data in DB:
"When a cmp-field and cmr-field are mapped to the same column, the setXXX method for the cmp-filed may not be called." If I use customerId for both entity bean's <primkey-field>, it works fine. I do not understand. I read some examples on CMR entity beans, and find all of them are using same <primkey-field>. Why I can not use different primary keys? I'm using WLS6.1SP3. Thanks.
Thanks Sai. If I also have LineIterm CMR entity beans. Each Order can have many LineIterms. LineIterm has a lineItermID as primary key and orderID as foreign key. Should I create a composite primary key that contains all there IDs (customerID, orderID, and lineItermID) for all the CMR beans (Customer, Order, LineIterm)? My basic question is whether I can use different primary key for different CMR entity bean. [ December 27, 2002: Message edited by: John King ]