Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [eclipselink-users] Question about Embeddable Classes

Thanks Guy,

this really helped a lot !!!

Bye,
Daniel



> -----Urspr√ľngliche Nachricht-----
> Von: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-
> bounces@xxxxxxxxxxx] Im Auftrag von Guy Pelletier
> Gesendet: Dienstag, 27. Januar 2009 14:49
> An: EclipseLink User Discussions
> Betreff: Re: [eclipselink-users] Question about Embeddable Classes
> 
> Daniel,
> 
> N levels of embeddable can be supported.
> 
> Yes, your recursive model is causing the stack overflow, you can't do
> that.
> 
> Collection's of embeddable will soon be supported through the use of
> ElementCollection from JPA2. In the mean time yes, you may use a
> descriptor
> customizer to map this manually. See @Customizer for more details. Your
> customizer class must implement the
> org.eclipse.persistence.config.DescriptorCustomizer interface.
> 
> Cheers,
> Guy
> 
> ----- Original Message -----
> From: <Daniel.Stucky@xxxxxxxxxxx>
> To: <eclipselink-users@xxxxxxxxxxx>
> Sent: Tuesday, January 27, 2009 8:24 AM
> Subject: [eclipselink-users] Question about Embeddable Classes
> 
> 
> Hi,
> 
> the JPA 1.0 specification says about embeddable classes
> - "Support for only one level of embedding is required by this
> specification."
> - "Support for collections of embedded objects and for the polymorphism
> and inheritance of embeddable classes will be required in
> a future release of this specification."
> 
> I did a test with the following classes that worked fine:
> 
> @Entity
> public class MyRecordImpl{
> 
>   @Id
>   @Column(name = "ID")
>   private String _id;
> 
>   @Embedded
>   private MyAttributeImpl _attribute;
> }
> 
> @Embeddable
> public class MyAttributeImpl{
> 
>   @Column(name = "ATT_NAME")
>   private String _name;
> 
>   @Column(name = "ATT_VALUE")
>   private String _value;
> 
>   @Embedded
>   @Column(name = "ANNOTATION")
>   private MyAnnotationImpl _annaotation;
> }
> 
> @Embeddable
> public class MyAnnotationImpl{
> 
>   @Column(name = "ANON_NAME")
>   private String _name;
> 
>   @Column(name = "ANON_VALUE")
>   private String _value;
> }
> 
> Does eclipseLink support more than one level of embedding or did this
> just function by accident ?
> How many levels are supported ?
> 
> 
> Would it be possible to recursively embed objects, like
> 
> @Entity
> public class MyRecordImpl{
> 
>   @Id
>   @Column(name = "ID")
>   private String _id;
> 
>   @Embedded
>   private MyAttributeImpl _attribute;
> }
> 
> @Embeddable
> public class MyAttributeImpl{
> 
>   @Column(name = "ATT_NAME")
>   private String _name;
> 
>   @Column(name = "ATT_VALUE")
>   private String _value;
> 
>   @Embedded
>   @Column(name = "REF_ATTRIBUTE")
>   private MyAttributeImpl _attribute;
> }
> 
> When I try this I get a java.lang.StackOverflowError, presumably
> because
> of the recursion.
> 
> 
> Also I've read that eclipseLink supports collections of embeddable and
> that it is set through using a DescriptorCustomizer and the
> AggregateCollectionMapping. Are there any examples in the wiki ? I
> found
> some documentation that I was unable to understand.
> I guess something like  private List<MyAttributeImpl> _attributes; as a
> member of MyAttributeImpl would still not be supported.
> 
> 
> Bye,
> Daniel
> 
> _______________________________________________
> 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


Back to the top