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 17:52 Go to next message
Larry  is currently offline Larry
Messages: 30
Registered: December 2009
Member
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.

Thanks!
Re: embedded object: field does not exist [message #634443 is a reply to message #633924] Thu, 21 October 2010 13:54 Go to previous message
James Sutherland is currently offline James Sutherland
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:How to use static weaving properly ?
Next Topic:EclipseLink - SQL Server - Unicode?
Goto Forum:
  


Current Time: Thu Aug 21 14:16:10 EDT 2014

Powered by FUDForum. Page generated in 0.02108 seconds