Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
monika se
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic