Interface between two related JPA entities

Posted by OpenSource on Stack Overflow See other posts from Stack Overflow or by OpenSource
Published on 2010-04-30T22:27:02Z Indexed on 2010/05/01 0:17 UTC
Read the original article Hit count: 622

Filed under:
|
|
|
|

The scenario is as below (tables shown)

Delivery table
------
id  channelId   type
10  100         fax
20  200         email

Fax table
----
id   number
100  1234567
101  1234598

Email table
-----
id   email
200  [email protected]
201  [email protected] 

basically a one to one relationship between the delivery and the channel entity but since each concrete channel(fax, email) has different members I want to create a generic interface (channel) between the two entities and use it for the @OneToOne relationship. Seems to me a simple scenario where lot of you might have already gone through but I'm unable to succeed. I tried putting that targetEntity thing but no use. Still says "delivery references an unknown entity"

Any ideas? thanks in advance

© Stack Overflow or respective owner

Related posts about jpa

Related posts about ejb3