aspose file tools*
The moose likes Object Relational Mapping and the fly likes How to do mapping in JPA when a table has a column that references 2 other table columns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to do mapping in JPA when a table has a column that references 2 other table columns" Watch "How to do mapping in JPA when a table has a column that references 2 other table columns" New topic
Author

How to do mapping in JPA when a table has a column that references 2 other table columns

monika se
Greenhorn

Joined: Mar 23, 2011
Posts: 22
I am having a table A with following structure:

Table A
Column a1(PK)
Column a2
.....

Table B
Column b1(PK)
Column b2
........


Table C
Column c1(PK)
Column c2
Column a1b1
......


In Column a1b1 of Table C we are storing the values from PK Column a1 from table A or PK Column b1 from Table B. i.e, some rows in Table C relates to Table A and some relates to Table B depending on this Column "a1b1" column value.
Please help me in doing the mapping for this case in JPA Annotations.


I have used below mapping that was NOT working.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to do mapping in JPA when a table has a column that references 2 other table columns