Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to map multiple properties to same column as writable in jpa

583281Jul 27 2007 — edited Jul 30 2007
Hi,
I am using toplink to support JPA.
I have the following requirement...
i have to map same column for multiple properties using @joincolumn annotation.. eg its something like this

@joincolumn(name="PARENT_RECORD_ID")
private Drug drug

@joincolumn(name="PARENT_RECORD_ID")
private Reaction reaction

PARENT_RECORD_ID is nothing but primary key of parent table.
but while accessing the application i am getting the following exception....

MULTIPLE_WRITE_MAPPINGS_FOR_FIELD

Cause: Multiple writable mappings for the field fieldName are defined in the descriptor. Exactly one must be defined as writable; the others must be specified as read-only. When multiple write mappings are defined for the field, TopLink is unable to choose the appropriate mapping for writing the value of the field in the database row. Therefore, the exception is raised during the validation process of descriptors.

Action: Make one of those mappings read-only

But i cannot make read only, if i make read only then while inserting new records it will be problem

Is it possible to have all the columns are writable with same column but one thing at same time multiple transcation cannot insert value into the same column...

please can anyone provide the solution or alternative approach to achieve same requirement.
Regards,
Saravanan.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2007
Added on Jul 27 2007
2 comments
1,666 views