openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fay Wang <>
Subject Re: Mapping different Embedded of the same type to the same table
Date Fri, 18 Jun 2010 17:01:39 GMT
       You can use @AttributeOverride to override the mapping of an embeddable field.


----- Original Message ----
From: stlecho <>
Sent: Fri, June 18, 2010 7:41:27 AM
Subject: Mapping different Embedded of the same type to the same table


I would like to map 2 Embedded properties with the same Embeddable to the
same table. When using underneath shown config, OpenJPA generates an
InvalidStateException (see stacktrace below).

Ideally, the Response.normalDetail and Response.servicesDetail properties
should be mapped respectively to

Is it possible to specify the NORMAL_ and SERVICES_ column prefixes in the
configuration of the Embedded properties ? If the answer is "no", which
alternatives do I have to solve this issue ?

public class Response
   protected Detail normalDetail;
   protected Detail servicesDetail;

public class Detail  
   protected Integer amount;
   protected String description;

Caused by: <openjpa-1.2.2-r422266:898935 fatal user error>
org.apache.openjpa.persistence.InvalidStateException: Attempt to set column
"Response.amount" to two different values: (class java.lang.Integer)"10",
(class java.lang.Integer)"1" This can occur when you fail to set both sides
of a two-sided relation between objects, or when you map different fields to
the same column, but you do not keep the values of these fields in synch. 
    at org.apache.openjpa.jdbc.sql.PrimaryRow.setObject( 
    at org.apache.openjpa.jdbc.sql.RowImpl.setObject( 

View this message in context:
Sent from the OpenJPA Users mailing list archive at


View raw message