Return-Path: Delivered-To: apmail-openjpa-users-archive@locus.apache.org Received: (qmail 98083 invoked from network); 14 Nov 2007 17:44:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Nov 2007 17:44:54 -0000 Received: (qmail 69175 invoked by uid 500); 14 Nov 2007 17:44:41 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 69160 invoked by uid 500); 14 Nov 2007 17:44:41 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 69151 invoked by uid 99); 14 Nov 2007 17:44:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2007 09:44:41 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [147.91.1.120] (HELO afrodita.rcub.bg.ac.yu) (147.91.1.120) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2007 17:45:35 +0000 Received: from [147.91.4.66] (ognjen-pc.rcub.bg.ac.yu [147.91.4.66]) by afrodita.rcub.bg.ac.yu (Postfix) with ESMTP id 3F36A1919552 for ; Wed, 14 Nov 2007 18:44:14 +0100 (CET) Message-ID: <473B33EB.3040302@etf.bg.ac.yu> Date: Wed, 14 Nov 2007 18:44:11 +0100 From: Ognjen Blagojevic User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: OpenJPA users list Subject: Merging an object Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-RCUB-MailScanner-Information: Please contact the ISP for more information X-RCUB-MailScanner: Found to be clean X-Virus-Checked: Checked by ClamAV on apache.org Hi all, I have a basic problem with openjpa 1.0.0. Merging and object results in this exception: org.apache.openjpa.persistence.InvalidStateException: The generated value processing detected an existing value assigned to this field: package.MyEntity.id. This existing value was either provided via an initializer or by calling the setter method. You either need to remove the @GeneratedValue annotation or modify the code to remove the initializer processing. I try to do just a simple operation of updating MyEntity.someField in database, for id=5, like this: MyEntity myEntity = new Entity(); myEntity.setId(5); myEntity.setSomeField("abc"); em = emf.createEntityManager(); em.getTransaction().begin(); em.merge(myEntity); em.getTransaction().commit(); em.close(); I tried to google, but no luck. Exception is thrown when merge method is called. Field id in MyEntity have @GeneratedValue(strategy = GenerationType.IDENTITY). Any suggestions? How do I update someField in MyEntity? Regards, Ognjen