Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Problem on Resin CMP

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I encounter some problems while using resin CMP.
I find that when I get a object and update the value of attribute, resin don't really update it, instead it produce a new record
This violate the primary key constraint of my database so error occurs:
Exception while try to update invoice: com.caucho.ejb.EJBExceptionWrapper: com.caucho.transaction.RollbackExceptionWrapper: com.caucho.ejb.EJBExceptionWrapper: com.sybase.jdbc2.jdbc.SybSQLException: Attempt to insert duplicate key row in object 'invoice_items' with unique index 'invoice_it_14011080821'

My method of update data is simple, it is just the following codes:
myInvoiceItem = invoiceItemHome.findByJobNumberAndTarget(invoice_jobNo, invoice_target);
myInvoiceItem.setPrice(to_supplier);

InvoiceItem findByJobNumberAndTarget(String job_number, String target)
throws FinderException;

<query>
<query-method>
<method-name>findByJobNumberAndTarget</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[
SELECT o FROM invoiceItems o
WHERE UPPER(o.jobNumber) LIKE UPPER(?1)
AND UPPER(o.invoiceTarget) LIKE UPPER(?2)
]]>
</ejb-ql>
</query>

I really don't know what is the problem. Can anyone help me?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic