Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] OUTER JOIN to Secondary Table

Normally 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


ashakirin wrote:
> 
> Is 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.
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/OUTER-JOIN-to-Secondary-Table-tp24494959p24518308.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top