Dear all,
I have a table with 2 primary keys as follows:

....
<field type="id-ne" name="asset_itemid"></field>
      <field type="id-ne" name="depid"/>
      <field type="id" name="account_no"/>
      <field type="currency-amount" name="value_before_cal"/>
      <field type="currency-amount" name="depre_value"/>
      <field type="currency-amount" name="value_after_cal"/>
      <field type="date" name="calculate_date"/>
      <field type="short-varchar" name="table_name"/>
      <prim-key field="asset_itemid"/>
      <prim-key field="calculate_date"/>
.....
Normally, if the table has 1 primary key, I will do like this:

GenericValue accObj = delegator.makeValue("DepreciationTrans", UtilMisc.toMap( "asset_itemid", asset_itemid)); //create generic value from id

but now I have 2 primary key, so I do like this:

GenericValue accObj = delegator.makeValue("DepreciationTrans", UtilMisc.toMap( "asset_itemid", asset_itemid),UtilMisc.toMap("calculate_date", calculate_date)); //create generic value from id

Then it caused error as follows:

2008-04-20 04:06:31,968 (http-0.0.0.0-8080-Processor3) [ RequestHandler.java:316:ERROR] Request doCreateDepreTable caused an error with the following message: Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (org.ofbiz.base.util.UtilMisc$SimpleMap)

How can I write code for table with 2 primary key to create GenericValue

Nattanicha

Reply via email to