Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Nested class entities

I found the answer in the spec (chapter 2.1.0): "The entity class must
be a top-level class."

On Sat, May 16, 2009 at 8:26 PM, Joe Mc. <m_joe_c@xxxxxxxxxxx> wrote:
>
> Learning by doing!
> ...and read the Spec for e.g. Chapter 2.1(.5)
>
> Are the classes AFoo and ABar really Entities with own tables?
>
>
>
> Jaka Jančar wrote:
>>
>> I'm not asking about @Embedded, but about @Entity. So:
>>
>> @Entity
>> class A {
>>  @Entity
>>  public static class AFoo implements XFoo {...}
>>  @Entity
>>  public static class ABar implements XBar {...}
>> }
>>
>>
>> They would not be embedded in the parent, but the parent would have a
>> @OneToMany relationship to them. Since I would never use AFoo and ABar
>> outside of A, I'd like to nest them.
>>
>> Jaka
>>
>> On Sat, May 16, 2009 at 7:51 PM, Joe Mc. <m_joe_c@xxxxxxxxxxx> wrote:
>>>
>>> Yes, Embeddable and Embedded are your friends ;-)
>>>
>>> Links:
>>> http://wiki.eclipse.org/Introduction_to_EclipseLink_JPA_(ELUG)#.40Embeddable
>>>
>>> Codesnippet:
>>>
>>> @Entity
>>> class A {
>>>  @Id
>>>  private Integer id;
>>>
>>>  @Embeddable
>>>  public static class B {
>>>
>>>  }
>>>
>>>  @Embedded
>>>  private B b;
>>>
>>> }
>>>
>>>
>>>
>>> Jaka Jančar wrote:
>>>>
>>>> Hi!
>>>>
>>>> Does JPA / EclipseLink support using @Entity on static nested classes?
>>>>
>>>> Jaka
>>>> _______________________________________________
>>>> eclipselink-users mailing list
>>>> eclipselink-users@xxxxxxxxxxx
>>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Nested-class-entities-tp23575979p23576197.html
>>> Sent from the EclipseLink - Users mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> eclipselink-users mailing list
>>> eclipselink-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>>
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Nested-class-entities-tp23575979p23576530.html
> Sent from the EclipseLink - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>


Back to the top