Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » ManyToOne in Embeddable
ManyToOne in Embeddable [message #379267] Tue, 12 August 2008 16:50 Go to next message
Jason Drake is currently offline Jason DrakeFriend
Messages: 13
Registered: July 2009
Junior Member
When I was re-defining one of my objects last night, the orm.xml was
invalidated on a ManyToOne relationship I had in an Embeddable. Now the
curious thing about this, is the annotation on the bean had previously
been in place for near a year (through using Hibernate, then Toplink and
now EclipseLink). I took a look at the persistence orm XML definition and
sure enough the error was correct... only BASIC and TRANSIENT are allowed.

So which is correct? The orm preventing this, or the annotations allowing
this?

Jason
Re: ManyToOne in Embeddable [message #379269 is a reply to message #379267] Wed, 13 August 2008 14:01 Go to previous messageGo to next message
Gordon Yorke is currently offline Gordon YorkeFriend
Messages: 78
Registered: July 2009
Member
Well the answer depends on your definition of 'correct'. The
specification does not allow relationship mappings within an Embeddable
but EclipseLink does. As the XSD is restrictive in nature and the XSD is
defined by the specification the validation error results. Annotations
definitions are not as restrictive and as EclipseLink supports
relationship mappings within an Embeddable the annotations are
successfully processed. This is the best compromise between functionality
and compliance.
--Gordon
Re: ManyToOne in Embeddable [message #379270 is a reply to message #379267] Wed, 13 August 2008 14:03 Go to previous message
James is currently offline JamesFriend
Messages: 272
Registered: July 2009
Senior Member
The JPA 1.0 spec does not allow any relationships in Embeddables.
EclipseLink does support this (as well as nested embeddables and
inheritance).

You can either,
- use the eclipselink-orm.xml instead of the JPA orm.xml
- keep using the annotation
- define the mapping using a DescriptorCustomizer
- or move it up from the embeddable to the parent

-- James
Previous Topic:ManyToMany: Why is no exception thrown?
Next Topic:Eclipselink and Spring
Goto Forum:
  


Current Time: Thu Apr 25 08:36:00 GMT 2024

Powered by FUDForum. Page generated in 0.03782 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top