persistence@glassfish.java.net

Re: Outer joins for secondary tables?

From: Markus Fuchs <Markus.Fuchs_at_Sun.COM>
Date: Thu, 03 Aug 2006 11:13:51 -0700

[including a broader audience]

Hi Gordon,

Thanks for your information! I have a couple of further questions:

Gordon Yorke wrote:

> Hello Markus,
> In TopLink a user can customize the MultipleTableJoinExpression in
> the DescriptorQueryManager. TopLink uses this expression when
> joining, updating this expression to use outer joins will cause
> TopLink to use outerjoins for secondary tables.
>
>
>
Is this customization a TopLink product feature? I understand it is not
part of TopLink-Essentials.

> This method, however, will only work for read-only objects as
> TopLink will be unable to update any secondary fields for objects that
> did not have a row in the secondary table. TopLink has no way of
> determining if the row was there once the object was built. Having
> this functionality would be a very large undertaking and would
> proportionally be of little value.
>
>
>
Does customizing the MultipleTableJoinExpression make the entity
read-only automatically or is it the user's responsibility to treat that
class as read-only? If the class is read-only automatically, would it be
possible to treat only the fields actually mapped to the secondary table
as read-only? In a JPA context, would it be sufficient to mark the
secondary table fields "updatable=false"?

Thanks!

-- markus.

>This sort of relationship should be mapped as an OneToOne.
>
>--Gordon
>
>-----Original Message-----
>From: Markus.Fuchs_at_Sun.COM [mailto:Markus.Fuchs_at_Sun.COM]On Behalf Of
>Markus Fuchs
>Sent: Wednesday, August 02, 2006 7:27 PM
>To: Tom Ware; Gordon Yorke
>Subject: Outer joins for secondary tables?
>
>
>Hi Tom, Gordon,
>
>I remember from one telephone meeting that TopLink can be switched
>from generating inner joins for secondary tables to outer
>joins.
>
>Looking into the code, I couldn't find such option. What am I missing?
>I couldn't even find an indicator in ClassDescriptor like
>"hasSecondaryTableMapping()". Is it possible to assume that the class
>has secondary table mappings, that if
>ClassDescriptor#additionalTablePrimaryKeyField != null?
>
>Thanks so much,
>
>-- markus.
>
>
>
>