openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ram <>
Subject @sqlresultsetmapping columns
Date Wed, 24 Feb 2016 21:43:04 GMT
Hi,        i have an entity called order which contains 10 columns and also has embeded
id(composite key)  coulmns which contains 5 fields in entity order.

 i was trying to build sql resultsetmapping in orm.xml

 <named-native-query name="OrderQuery" result-set-mapping="OrderQueryResultSetMapping">
<query><![CDATA[SELECT t0.colum2, t0.column4, to.embededid.colum3,   e mbededid.colum1,
FROM order  t0 WHERE t0.orderid = ?1 ]]></query> </named-native-query>
 <sql-result-set-mapping name="OrderQueryResultSetMapping"> <entity-result entity-class="order">
<field-result name="column2" column="column_2" /> <field-result name="column4" column="column_4"
/> </entity-result> <entity-result entity-class="orderembededId">  <field-result
name="column3" column="column_3" /> <field-result name="column4"1column="column_1" />
</entity-result> </sql-result-set-mapping>

i don't have issues in query execution, but getting error in sqlResultSetMapping.   i am
getting the following error.

Exception in thread "main" <openjpa-2.4.0-r422266:1674604 fatal general error> org.apache.openjpa.persistence.PersistenceException:
[jcc][t4][10145][10897][3.58.81] Invalid parameter 0: Parameter index is out of range. ERRORCODE=-4461,

can we do this kind of mapping? if so, how do client knows what are the columns are populated
for Order entity as part of this query.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message