Hi,
i am integrating SmartGWT (Power 3.0) CMT in my application.
I have problems in fetching data from a table with a multiple primary key.
This are the entity bean and the primary key auto-generated class:
-----------------------------------------------------------------------------------
@Entity
@Table(name="xx", schema="xx")
public class HistoricalPricesEntity implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private HistoricalPricesEntityPK id;
@Column(name="CLOSEPR", nullable=false, precision=16, scale=5)
private BigDecimal closingPrice;
@Column(name="P_FILE_ID", nullable=false)
private int parentFileId;
.
.
.
@Column(nullable=false, length=1)
private String status;
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
@Embeddable
public class HistoricalPricesEntityPK implements Serializable {
//default serial version id, required for serializable classes.
private static final long serialVersionUID = 1L;
@Column(name="INSTR_ID", unique=true, nullable=false)
private int instrumentId;
@Column(unique=true, nullable=false)
private int priceDate;
@Column(unique=true, nullable=false)
private int priceTime;
.
.
.
-----------------------------------------------------------------------------------
My DataSource is auto-derivated:
-----------------------------------------------------------------------------------
<DataSource
ID="hisPr"
serverConstructor="com.isomorphic.jpa.JPADataSource"
autoDeriveSchema="true"
schemaBean="server.entity.HistoricalPricesEntity"
>
-----------------------------------------------------------------------------------
When fetching, i have the following error:
[28/08/12 17.25.28:161 CEST] 00000038 SystemOut O === 2012-08-28 17:25:28,161 [ : 6] WARN RequestContext - dsRequest.execute() failed:
org.apache.openjpa.persistence.ArgumentException: Error in query "select count (_HistoricalPricesEntity.id_priceTime) from HistoricalPricesEntity _HistoricalPricesEntity". Error message: No "id_priceTime" field in class "class server.entity.HistoricalPricesEntity".
SmartGwt engine is searching a "id_priceTime" field (which doesn't exist) in HistoricalPricesEntity class, not the "priceTime" field in HistoricalPricesEntityPK class.
What is the problem?
What is the right configuration to make it works?
Thanks in advance for your help.
Giervella
i am integrating SmartGWT (Power 3.0) CMT in my application.
I have problems in fetching data from a table with a multiple primary key.
This are the entity bean and the primary key auto-generated class:
-----------------------------------------------------------------------------------
@Entity
@Table(name="xx", schema="xx")
public class HistoricalPricesEntity implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private HistoricalPricesEntityPK id;
@Column(name="CLOSEPR", nullable=false, precision=16, scale=5)
private BigDecimal closingPrice;
@Column(name="P_FILE_ID", nullable=false)
private int parentFileId;
.
.
.
@Column(nullable=false, length=1)
private String status;
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
@Embeddable
public class HistoricalPricesEntityPK implements Serializable {
//default serial version id, required for serializable classes.
private static final long serialVersionUID = 1L;
@Column(name="INSTR_ID", unique=true, nullable=false)
private int instrumentId;
@Column(unique=true, nullable=false)
private int priceDate;
@Column(unique=true, nullable=false)
private int priceTime;
.
.
.
-----------------------------------------------------------------------------------
My DataSource is auto-derivated:
-----------------------------------------------------------------------------------
<DataSource
ID="hisPr"
serverConstructor="com.isomorphic.jpa.JPADataSource"
autoDeriveSchema="true"
schemaBean="server.entity.HistoricalPricesEntity"
>
-----------------------------------------------------------------------------------
When fetching, i have the following error:
[28/08/12 17.25.28:161 CEST] 00000038 SystemOut O === 2012-08-28 17:25:28,161 [ : 6] WARN RequestContext - dsRequest.execute() failed:
org.apache.openjpa.persistence.ArgumentException: Error in query "select count (_HistoricalPricesEntity.id_priceTime) from HistoricalPricesEntity _HistoricalPricesEntity". Error message: No "id_priceTime" field in class "class server.entity.HistoricalPricesEntity".
SmartGwt engine is searching a "id_priceTime" field (which doesn't exist) in HistoricalPricesEntity class, not the "priceTime" field in HistoricalPricesEntityPK class.
What is the problem?
What is the right configuration to make it works?
Thanks in advance for your help.
Giervella
Comment