Forums Register Login

Choose primary key for CMR entity beans

+Pie Number of slices to send: Send
Hi everyone,
I have a question on choose primary key for CMR entity beans. I'm using following entity beans:
Customer, Order, and LineIterm. They have their own primary key: customerId for Customer, orderId for Order,
and lineItermId for LineIterm. Customer has a orderId as its foreign key while Order has customerId
and lineItermId as its foreign keies. One Customer may have many Orders, and one Order may have many
LineIterms. I'm using CMR, so they are jared together. When I specified
<primkey-field> with different cmp field (customerId for Customer, orderId for Order, lineItermId for
LineIterm) 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 all entity beans' <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>. My question
is whether I can use different primary key for different CMR entity bean and why?
Thanks for any inputs.
Run away! Run away! Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 737 times.
Similar Threads
deployment exception with compound primary key in jboss3.0 getUniqueChild exception
Help! Problem using 1:1 CMP Relationship example using JBoss 3.0.0
CMP - CMR for the same field?
Error in EJB2.0 CMR Deployment
CMR entity beans and primary key.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 09:39:39.