|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
OUTER JOIN to Secondary TableIs it any way in EclipseLink to make OUTER JOIN to Secondary Table?
Use case: There is a main employee table that may or may not have some extra data populated in a related secondary table. If there is data in the secondary table (@SecondaryTable), then I would like my Employee entity to have those fields filled in. If there isn't data for a given employee in the secondary table, then I would like my Employee entity to have nulls in those fields. Right now, if there's no row in the secondary table for a given employee, I get nothing. Unfortunately I cannot find acceptable solution in Internet. Is INNER JOIN for Secondary Table fixed by design? Regards, Andrei. |
|
|
|
|
|
|
|
|
Re: OUTER JOIN to Secondary TableNormally if an outerjoin is desired, you should instead use a OneToOne relationship instead of a multiple table mapping. The issue is just not in reading the class, but updating or inserting a row that may not be there is problematic.
If you must use a multiple table mapping, then you can use a DescriptorCustomizer to set the multipleTableJoinExpression for your descriptor to one using equalOuterJoin. Another solution would be to define a view that does the other join and map to it. See also, http://en.wikibooks.org/wiki/Java_Persistence/Tables#Multiple_table_outer_joins
James Sutherland EclipseLink, TopLink Wiki: EclipseLink, TopLink Forums: TopLink, EclipseLink Book: Java Persistence |
| Free embeddable forum powered by Nabble | Forum Help |