Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 7513 invoked from network); 22 Nov 2007 14:12:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Nov 2007 14:12:44 -0000 Received: (qmail 33090 invoked by uid 500); 22 Nov 2007 14:12:30 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 33054 invoked by uid 500); 22 Nov 2007 14:12:30 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 33043 invoked by uid 99); 22 Nov 2007 14:12:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Nov 2007 06:12:29 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Nov 2007 14:12:33 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1IvCmq-0007EV-Pm for user@geronimo.apache.org; Thu, 22 Nov 2007 06:12:12 -0800 Message-ID: <13897173.post@talk.nabble.com> Date: Thu, 22 Nov 2007 06:12:12 -0800 (PST) From: maho77 To: user@geronimo.apache.org Subject: EntityExistsException: Attempt to persist detached object MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: m.hoffmann@mvolution.de X-Virus-Checked: Checked by ClamAV on apache.org Hello, I get the following Exception, when I try to persist an Entity: 14:53:06,841 ERROR [LoginAdminImpl] Fehler beim Speichern der MTIGroup org.apache.openjpa.persistence.EntityExistsException: Attempt to persist detached object "entities.MTIGroup@61a661a6". FailedObject: entities.MTIGroup@61a661a6 at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2358) at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2216) at org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1005) at org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:541) at org.apache.geronimo.persistence.CMPEntityManagerTxScoped.persist(CMPEntityManagerTxScoped.java:83) at beans.LoginAdminImpl.createGroup(LoginAdminImpl.java:159) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:146) at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:129) at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67) at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:203) at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165) at org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:212) at org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:120) at org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164) at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122) at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84) at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60) at org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:73) at org.apache.openejb.server.ServiceAccessController.service(ServiceAccessController.java:55) at org.apache.openejb.server.ServiceDaemon$1.run(ServiceDaemon.java:117) at java.lang.Thread.run(Thread.java:810) This is the Entity: @Entity @Table(name="group_table") public class MTIGroup implements Serializable, IMTIGroup { private int id = -1; private String name = new String(); private String description = new String(); public MTIGroup() { } @TableGenerator(name="GroupIdGen", table="ID_GENERATOR", pkColumnName="name", valueColumnName="id_value", pkColumnValue="group_table", initialValue=0, allocationSize=1) @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="GroupIdGen") public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } } This is the StatefulBean-Method: @PersistenceContext(unitName="xxx") private EntityManager em; ... public void createGroup(MTIGroup group) { if (group != null) { try { em.persist(group); } catch (Exception e) { logger.error("Error saving MTIGroup", e); } } } This is the stand-alone client code: InitialContext ic = null; Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory"); properties.put(Context.PROVIDER_URL,"ejbd://localhost:4201"); try { ic = new InitialContext(properties); TestImplRemote lar = (TestImplRemote)ic.lookup("TestImplEJBRemote"); MTIGroup g1 = new MTIGroup(); g1.setId(2); g1.setName("testGroup"); g1.setDescription("Description for testGroup"); lar.createGroup(g1); } catch (NamingException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } and this the persistence.xml part: xxxDataSouurce entities.MTIGroup true What goes wrong here? Other Entities can be persisted easily with the same structure. I've already tried a bean managed transaction, all with the same result. Can anybody help me and bring to the right direction? Thank you, Mark -- View this message in context: http://www.nabble.com/EntityExistsException%3A-Attempt-to-persist-detached-object-tf4856534s134.html#a13897173 Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.