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, SQLSTATE=42815

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.


Reply via email to