Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » embedded object: field does not exist(override field in the embedded object that does not exist on table)
embedded object: field does not exist [message #633924] Tue, 19 October 2010 21:52 Go to next message
Larry  is currently offline Larry Friend
Messages: 30
Registered: December 2009
I created an Embedded object that I would like to reuse. The problem is that some of the fields in the embedded object are not always used.

For instance, I have an Address object that has addr1 and addr2 fields. There are some cases where I do not have an addr2 in the DB to map to (sometimes, I do!).

How do you get around this problem. Seems like it should be a simple override, but can't find info on it.

Re: embedded object: field does not exist [message #634443 is a reply to message #633924] Thu, 21 October 2010 17:54 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can't do this with overrides.

You can have two different Address classes, one for each type of Address. You could potentially use inheritance in the embeddable for this, JPA does not support inheritance in Embeddables, but EclipseLink does support inheritance in Embeddable (only at runtime currently, you would need to define the mappings in code).

James : Wiki : Book : Blog : Twitter
Previous Topic:Eclipselink query optimization problem
Next Topic:Standalone use of MOXy
Goto Forum:

Current Time: Thu Apr 19 15:26:26 GMT 2018

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

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