Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsMapping two objects on same table
https://www.eclipse.org/forums/index.php/mv/msg/166763/528692/#msg_528692
I m working on a legacy database. I m encountering the following problem, there is two classes mapped into a single table. The only way to differentiate them is their id.
The Id of each of thel belongs to two differents sequences.
Example :
create table Objet ( ID number (10), value varchar2(50), value2 varchar2(50) );
create sequence seq1 start with 1 increment by 1 maxvalue 199;
create sequence seq2 start with 200 increment by 1 maxvalue 299;
I have two classes one corresponding to the value of the first sequence and the other to second one. these two classes do not belong to same hierarchy
I m using JPA 1.0 based on eclipselink 1.0.2.
I can not find a way to do this, can you help me?
X
]]>Xavier Z2010-04-21T13:52:08-00:00Re: Mapping two objects on same table
https://www.eclipse.org/forums/index.php/mv/msg/166763/528939/#msg_528939
You could map this in EclipseLink. You could set an additionalJoinExpression on the two classes where the id < 200, and id >= 200. You would need to do this in code, using a DescriptorCustomizer.
public void customize(ClassDescriptor descriptor) {
descriptor.getQueryManager().setAdditionalJoinExpression(... );
}]]>James Sutherland2010-04-22T13:18:30-00:00Re: Mapping two objects on same table
https://www.eclipse.org/forums/index.php/mv/msg/166763/531050/#msg_531050
]]>Xavier Z2010-05-03T14:08:30-00:00Re: Mapping two objects on same table
https://www.eclipse.org/forums/index.php/mv/msg/166763/531061/#msg_531061
Do you have any idea ?
]]>Xavier Z2010-05-03T14:40:25-00:00Re: Mapping two objects on same table
https://www.eclipse.org/forums/index.php/mv/msg/166763/531073/#msg_531073
]]>James Sutherland2010-05-03T15:32:24-00:00Re: Mapping two objects on same table
https://www.eclipse.org/forums/index.php/mv/msg/166763/531800/#msg_531800
it's working, thanks a lot for your help.]]>Xavier Z2010-05-06T09:11:58-00:00