Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » missing Embeddable
missing Embeddable [message #1064884] Fri, 21 June 2013 14:05 Go to next message
Hannes Kühtreiber is currently offline Hannes KühtreiberFriend
Messages: 21
Registered: June 2013
Junior Member
Hello everybody,
I an new to EclipseLink and I try to get a mapping to work.
I have modelled a Person in EMF as an example for a class in a legacy DB with 100+ attributes.
Some of these I want to move to an Additional Object while in the DB these attributes are in the same table.

So, in EMF I modelled Person & Additional, generating classes and Impls.
All working well. Enter the Embeddable
<orm:entity class="model.impl.PersonImpl" name="Person">
		<orm:table name="Table_Person" />
		<orm:attributes>
...
		<orm:embedded name="addi">
			<orm:attributes-override name="nonsenseField">
				<column name="p_nonsenseField"/>
			</orm:attributes-override>
		</orm:embedded>

I am getting the following exception:
Exception Description: The Entity class [class model.impl.PersonImpl] has an embedded attribute [addi] of type [class model.Additional] which is NOT an Embeddable class. Probable reason: missing @Embeddable or missing <embeddable> in orm.xml if metadata-complete = true

I have added @Embeddable to PersonImpl, which does not help.
I have added @Embeddable to Person, which does not help either because the Interface Person does not have a default constructor.

I have also tried to declare the embeddable in the orm.xml:
	<orm:embedabble class="model.impl.AdditionalImpl">
		<attributes>
			<basic name="nonsenseField" />
		</attributes>
	</orm:embedabble>

which does not help either.

what to do?

I have been banging my head against the keyboard all afternoon ...
Hannes

Re: missing Embeddable [message #1065383 is a reply to message #1064884] Tue, 25 June 2013 14:02 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
The error mentions addi is of type model.Additional, so model.Additional should be mapped as an embeddable class for it to be used.
Re: missing Embeddable [message #1065391 is a reply to message #1065383] Tue, 25 June 2013 14:26 Go to previous messageGo to next message
Hannes Kühtreiber is currently offline Hannes KühtreiberFriend
Messages: 21
Registered: June 2013
Junior Member
Chris,
In emf I modeled Person with an attribute "addi" of type Additional.

I'd prefer to not to use Annotations if this is possible.

I tried to specify Additional to be embeddable in the orm.xml - see first mail. What is wrong with the way I did it?

Hannes

Re: missing Embeddable [message #1065486 is a reply to message #1065391] Wed, 26 June 2013 00:54 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
You mapped model.impl.AdditionalImpl in the post, you need a mapping for the model.Addional class.
Re: missing Embeddable [message #1066627 is a reply to message #1065486] Wed, 03 July 2013 13:52 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

I assume Person and Additional are interfaces, and the Impls are the classes. In JPA you only map the classes, not the interfaces.

If the reference is an interface you need to set the targetEntity to the impl (for OneToOne, etc.), but unfortunately the JPA does not define a targetClass for Embedded.

In EclipseLink you can use the eclipselink-orm.xml file, and specify the @attribute-type on the <embedded> mapping.

See also,
http://en.wikibooks.org/wiki/Java_Persistence/Advanced_Topics#Interfaces



James : Wiki : Book : Blog : Twitter
Re: missing Embeddable [message #1066635 is a reply to message #1066627] Wed, 03 July 2013 14:06 Go to previous message
Hannes Kühtreiber is currently offline Hannes KühtreiberFriend
Messages: 21
Registered: June 2013
Junior Member
thanks James - this looks promising! I already abandoned the idea of using embeddables because it appeared impossible but I'll try again.
Hannes
Previous Topic:Predeployment of PersistenceUnit [. . .] failed
Next Topic:Nulling an embedded object does not affect the database upon merge
Goto Forum:
  


Current Time: Fri Apr 26 03:33:35 GMT 2024

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

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

Back to the top