users@glassfish.java.net

how to join with discriminator column?

From: <glassfish_at_javadesktop.org>
Date: Thu, 04 Sep 2008 03:27:52 PDT

Hi,
I have a table that is designed in such a way the discriminator column is a foreign key to another table.

Annotating the target entity with @JoinColumn in the first entity bean does not work. It is always null. I can't think of another approach other than using instanceof to determine the type of first entity returned, and use entity manager to find the target entity. In most cases, I have to hard code the primary key in the argument to the entity manager's find method. I believe there must be an easier way to this problem.

Am I missing something somewhere?
Thanks in advance!
[Message sent by forum member 'phuihock' (phuihock)]

http://forums.java.net/jive/thread.jspa?messageID=297157