I don't think you are right Gail. You can use secondary tables even if no association
are involved. We happen to use the secondary table mechanism to map one to one + join
table but that's an implementation detail of Hibernate ORM.
On 1 mars 2013, at 20:49, Gail Badner <gbadner(a)redhat.com> wrote:
Actually, there are entities used in unit tests with @SecondaryTable
defined with only *-to-one attributes that refer to those tables:
org.hibernate.test.annotations.inheritance.mixed.File
org.hibernate.test.annotations.inheritance.mixed.SymbolicLink
org.hibernate.test.annotations.manytoone.OrderLine
org.hibernate.test.annotations.onetoone.Client
Unless I hear otherwise, I'll assume @SecondaryTable can optionally be defined if
only associations refer to it.
Gail
----- Original Message -----
> From: "Gail Badner" <gbadner(a)redhat.com>
> To: "Hardy Ferentschik" <hardy(a)hibernate.org>
> Cc: "Hibernate hibernate-dev" <hibernate-dev(a)lists.jboss.org>
> Sent: Friday, March 1, 2013 11:06:04 AM
> Subject: Re: [hibernate-dev] Is @SecondaryTable required when a join table is
specified?
>
> Hi Hardy,
>
> I've seen lots of unit tests that have @SecondaryTable. I didn't make
> the connection that it was non-association attributes that refer to
> a secondary table.
>
> Thanks for the clarification.
> Gail
>
> ----- Original Message -----
>> From: "Hardy Ferentschik" <hardy(a)hibernate.org>
>> To: "Gail Badner" <gbadner(a)redhat.com>
>> Cc: "Hibernate hibernate-dev" <hibernate-dev(a)lists.jboss.org>
>> Sent: Friday, March 1, 2013 2:07:56 AM
>> Subject: Re: [hibernate-dev] Is @SecondaryTable required when a
>> join table is specified?
>>
>> Hi,
>>
>> Secondary tables and associations (join tables) are really two
>> different things. A secondary table allows you to map your entity
>> properties to
>> multiple tables. @JoinTable on the other hand are used to map
>> associations and configure certain properties of the join table.
>> One does not require the other. I am not sure what makes you
>> believe
>> that using @JoinTable requires the use of @SecondaryTable.
>> If you after some examples have a look at the JPA spec as well. It
>> is
>> a good starting point.
>>
>> Regarding the metamodel branch, I am not sure about the binders and
>> so on, but afaicr the sources does not imply the link
>> between join table and secondary table.
>>
>> --Hardy
>>
>>
>> On 1 Jan 2013, at 7:13 AM, Gail Badner <gbadner(a)redhat.com> wrote:
>>
>>> I noticed that
>>> org.hibernate.test.annotations.onetoone.OneToOneTest
>>> and OptionalOneToOnePKJCTest uses this mapping:
>>>
>>>
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src...
>>>
>>> Son.father specifies a join-table ("father_son"), but has no
>>> <secondary-table>. There is no @SecondaryTable defined in Son
>>> (this is a unidirectional association).
>>>
>>> I thought that @SecondaryTable was required when an association
>>> uses a join table. Currently, that's how it works in the new
>>> metamodel.
>>>
>>> Should it be optional?
>>>
>>> Thanks,
>>> Gail
>>> _______________________________________________
>>> hibernate-dev mailing list
>>> hibernate-dev(a)lists.jboss.org
>>>
https://lists.jboss.org/mailman/listinfo/hibernate-dev
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/hibernate-dev
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev