Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 35076 invoked from network); 1 Mar 2007 19:04:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Mar 2007 19:04:19 -0000 Received: (qmail 64567 invoked by uid 500); 1 Mar 2007 19:04:28 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 64544 invoked by uid 500); 1 Mar 2007 19:04:28 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 64535 invoked by uid 99); 1 Mar 2007 19:04:28 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2007 11:04:28 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of matthieu.riou@gmail.com designates 64.233.182.190 as permitted sender) Received: from [64.233.182.190] (HELO nf-out-0910.google.com) (64.233.182.190) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2007 11:04:16 -0800 Received: by nf-out-0910.google.com with SMTP id d4so996019nfe for ; Thu, 01 Mar 2007 11:03:55 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Xyo1BOIXP++r16Dj9/rwTb8srdBBohcKGOOcUMsflkpA5SqW4Uuw1Qr/TMFqDWWDbk7o1QMQdFU0C2OUD3WwH6uE2YzdbLyFdXE/GGk6h5FW/8pmI+FDYCCaYgPebsY+2zgU4FDBvkL4Am6okgy+W+1dEQFgDy14nZt+UIO7ndc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=VV5GeTIoZeYoK6apZtdYDqW51aCav5uPuZ/w8edSFWQ9YRhu+IjU9I52rqtDlapw/fvvA/qVNtXoJaumdXuGwI+VgBNjUyBKCMBJUAmzeqBKwsqfMSqXt0y+wacAWUcYSd/blwsTR14jOISd98OpZYFXEB6q/RH2B/IX8d6NfTo= Received: by 10.49.13.14 with SMTP id q14mr6254280nfi.1172775834747; Thu, 01 Mar 2007 11:03:54 -0800 (PST) Received: by 10.49.51.1 with HTTP; Thu, 1 Mar 2007 11:03:54 -0800 (PST) Message-ID: Date: Thu, 1 Mar 2007 11:03:54 -0800 From: "Matthieu Riou" Reply-To: matthieu.riou@gmail.com To: "Patrick Linskey" Subject: Re: OpenJPA & Transaction configuration Cc: open-jpa-dev@incubator.apache.org In-Reply-To: <7D856CDFE035FF45A0420ACBD71BDD6303593206@repbex02.amer.bea.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_26372_32696660.1172775834643" References: <5C219175D559A64D8C2CC65E41D36856D39C30@repbex01.amer.bea.com> <7D856CDFE035FF45A0420ACBD71BDD630359319F@repbex02.amer.bea.com> <7D856CDFE035FF45A0420ACBD71BDD6303593206@repbex02.amer.bea.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_26372_32696660.1172775834643 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks for all the feedback, let me remove the @Version (it should really be a basic field instead as it's app specific) and test it again. On 3/1/07, Patrick Linskey wrote: > > > Here is a link to the source (and no version field): > > There is a version field in there. How are you invoking the non-default > constructor? As Abe mentioned, if your version field is set to a value > other than the Java default (0 in this case), OpenJPA will assume that > the instance is detached. > > -Patrick > > -- > Patrick Linskey > BEA Systems, Inc. > > _______________________________________________________________________ > Notice: This email message, together with any attachments, may contain > information of BEA Systems, Inc., its subsidiaries and affiliated > entities, that may be confidential, proprietary, copyrighted and/or > legally privileged, and is intended solely for the use of the individual > or entity named in this message. If you are not the intended recipient, > and have received this message in error, please immediately return this > by email and then delete it. > > > -----Original Message----- > > From: Matthieu Riou [mailto:matthieu.riou@gmail.com] > > Sent: Wednesday, February 28, 2007 9:51 PM > > To: Patrick Linskey > > Cc: open-jpa-dev@incubator.apache.org > > Subject: Re: OpenJPA & Transaction configuration > > > > Here is a link to the source (and no version field): > > > > http://svn.apache.org/repos/asf/incubator/ode/trunk/dao-jpa/sr > c/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java > > > > How can I try to change the default detach manager? Which one > > should I use instead? > > > > Thanks! > > Matthieu > > > > > > On 2/28/07, Patrick Linskey < plinskey@bea.com> wrote: > > > > Can you post the source for ProcessDAOImpl? Also, are > > there any other > > OpenJPA properties in your configuration? Finally, I'm > > assuming that > > you're using a somewhat-current 0.9.7-SNAPSHOT. Correct > > me if I'm wrong. > > > > > But shouldn't I worry about the fact that a brand new > > > instance is detached? I could be wrong but it looks > > > like it's more a symptom of > > > > I believe that you should. I think I remember reading > > something about > > this recently, but I don't remember the details. My > > suspicion is that > > you don't have an @Version field, and you're using the > > default detach > > manager. IIRC, this combination leaves OpenJPA with no > > way to detect a > > detached object vs. a new object, and we default to > > detached. I thought > > that we had improved the docs around this at the least; > > certainly, it'd > > be good to figure out your particulars and make sure > > that this is > > clearer for others. > > > > (IIRC, the default detach manager uses a heuristic on > > the value in the > > version field to determine whether an instance is new > > or detached. > > OpenJPA supports more flexible detach managers that can > > do fun things > > like providing useful errors when attempting to > > navigate past the end of > > a detached object graph, and fine-grained tracking of > > changes made while > > detached. But it's not serialization-compatible with > > the unenhanced > > code, meaning that you need to put the enhanced classes > > into your client > > tier, which I think that we decided was a bad default.) > > > > -Patrick > > > > -- > > Patrick Linskey > > BEA Systems, Inc. > > > > > > ______________________________________________________________ > > _________ > > Notice: This email message, together with any > > attachments, may contain > > information of BEA Systems, Inc., its subsidiaries > > and affiliated > > entities, that may be confidential, proprietary, > > copyrighted and/or > > legally privileged, and is intended solely for the use > > of the individual > > or entity named in this message. If you are not the > > intended recipient, > > and have received this message in error, please > > immediately return this > > by email and then delete it. > > > > > -----Original Message----- > > > From: Matthieu Riou [mailto:matthieu.riou@gmail.com] > > > Sent: Wednesday, February 28, 2007 7:50 PM > > > To: Pinaki Poddar > > > Cc: open-jpa-dev@incubator.apache.org > > > > > Subject: Re: OpenJPA & Transaction configuration > > > > > > Thanks! But shouldn't I worry about the fact that a brand new > > > instance is > > > detached? I could be wrong but it looks like it's > > more a symptom of > > > something wrong in my configuration, no? > > > > > > On 2/28/07, Pinaki Poddar wrote: > > > > > > > > instead of _em.persist(ret); > > > > try > > > > _em.merge(ret); > > > > > > > > as ret is detached instance rather than new. > > > > > > > > > > > > > > > > Pinaki Poddar > > > > BEA Systems > > > > 415.402.7317 > > > > > > > > > > > > -----Original Message----- > > > > From: Matthieu Riou [mailto:matthieu.riou@gmail.com] > > > > Sent: Wednesday, February 28, 2007 6:29 PM > > > > To: open-jpa-dev@incubator.apache.org > > > > Subject: OpenJPA & Transaction configuration > > > > > > > > Hi, > > > > > > > > I'm going back at the OpenJPA implementation for the Apache > > > ODE project > > > > and am still having problems with the setup. Whan I try to > > > persist a new > > > > object I get an exception "Attempt to persist detached > > > object". I guess > > > > the when I instantiate my object OpenJPA can't locate its > > > transactional > > > > context or something related therefore assuming > > that the object is > > > > instantiated outside of any persistent context. > > > > > > > > Here is the code that creates the EntityManagerFactory: > > > > > > > > HashMap propMap = new > > > HashMap(); > > > > propMap.put("openjpa.Log", "DefaultLevel=TRACE"); > > > > propMap.put("openjpa.jdbc.DBDictionary", " > > > > org.apache.openjpa.jdbc.sql.DerbyDictionary"); > > > > propMap.put("openjpa.ManagedRuntime", new > > TxMgrProvider()); > > > > propMap.put("openjpa.ConnectionFactory", _ds); > > > > > > propMap.put("openjpa.ConnectionFactoryMode", "managed"); > > > > propMap.put("openjpa.Log", "DefaultLevel=TRACE"); > > > > _emf = > > Persistence.createEntityManagerFactory("ode-dao", > > > > propMap); > > > > > > > > And here is my object instantiation code: > > > > > > > > ProcessDAOImpl ret = new > > > > ProcessDAOImpl(pid,type,guid,this,version); > > > > System.out.println("detached " + > > > > ((PersistenceCapable)ret).pcIsDetached()); > > > > _em.persist(ret); > > > > > > > > My little debugging statement outputs "true". I've > > > reproduced the full > > > > log below. I've also encapsulated to transaction > > manager and the > > > > transaction to check whether OpenJPA was getting > > the transaction and > > > > registering a synchronizer properly. It seems to be doing > > > so (the log > > > > statements are just a couple lines above the '.....'). I've > > > removed all > > > > the mapping logs just to avoid making this too lengthy. > > > > > > > > Any idea of what the problem could be? I'm kind of stuck on > > > this as it's > > > > hard to debug the enhanced code that gets called when I > > > instantiate my > > > > process object. > > > > > > > > DEBUG - ODEMessageReceiver.receive(47) | Received > > message for > > > > helloWorld.hello DEBUG - > > > ODEService.onAxisMessageExchange(96) | Starting > > > > transaction. > > > > DEBUG - BpelEngineImpl.route(237) | Routed: svcQname { > > > > http://ode/bpel/unit-test.wsdl}HelloService --> > > BpelProcess[{ > > > > http://ode/bpel/unit-test}HelloWorld2-1] > > > > 29603 ode-dao INFO [http-8080-Processor25] > > openjpa.Runtime - > > > > Starting > > > > OpenJPA 0.9.7-incubating-SNAPSHOT > > > > 29604 ode-dao TRACE [http-8080-Processor25] > > openjpa.Runtime - > > > > Properties: > > > > openjpa.EntityManagerFactory: default > > > > openjpa.DataCache: false > > > > openjpa.MetaDataFactory: jpa(Types= > > > > org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl > > > > > > > ;org.apache.ode.dao.jpa.CorrelationSetDAOImpl;org.apache.ode.d > > > ao.jpa.Cor > > > > > > > relatorDAOImpl;org.apache.ode.dao.jpa.EventDAOImpl;org.apache. > > > ode.dao.jp > > > > > > > a.FaultDAOImpl;org.apache.ode.dao.jpa.MessageDAOImpl;org.apach > > > e.ode.dao . > > > > > > > jpa.MessageExchangeDAOImpl;org.apache.ode.dao.jpa.MessageRoute > > > DAOImpl;or > > > > > > > g.apache.ode.dao.jpa.PartnerLinkDAOImpl;org.apache.ode.dao.jpa > > > .ProcessDA > > > > > > > OImpl;org.apache.ode.dao.jpa.ProcessInstanceDAOImpl;org.apache > > > .ode.dao.j > > > > pa.ScopeDAOImpl;org.apache.ode.dao.jpa.XmlDataDAOImpl) > > > > openjpa.InverseManager: false > > > > openjpa.ReadLockLevel : read > > > > openjpa.DataCacheManager: default > > > > openjpa.jdbc.SubclassFetchMode: join > > > > openjpa.jdbc.UpdateManager: default > > > > openjpa.jdbc.SynchronizeMappings: false > > > > openjpa.NontransactionalRead : true > > > > openjpa.QueryCompilationCache: true > > > > openjpa.MaxFetchDepth: -1 > > > > openjpa.RetainState: true > > > > openjpa.DynamicDataStructs: false > > > > openjpa.BrokerFactory: jdbc > > > > openjpa.WriteLockLevel: write > > > > openjpa.ManagedRuntime: > > > > > > org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl$TxMgrProvider > > > > openjpa.jdbc.EagerFetchMode: parallel > > > > openjpa.RestoreState: immutable > > > > openjpa.jdbc.SchemaFactory: dynamic > > > > openjpa.LockManager: version > > > > openjpa.BrokerImpl: default > > > > openjpa.NontransactionalWrite: true > > > > openjpa.MetaDataRepository: default > > > > openjpa.Log: true(DefaultLevel=TRACE) > > > > openjpa.jdbc.ResultSetType: forward-only > > > > openjpa.AutoDetach: > > > > openjpa.ConnectionRetainMode: on-demand > > > > openjpa.SavepointManager: in-mem > > > > openjpa.jdbc.DBDictionary: derby > > > > openjpa.Optimistic: true > > > > openjpa.ConnectionFactoryMode: managed > > > > openjpa.Sequence: table > > > > openjpa.FetchGroups: default > > > > openjpa.jdbc.Schemas: > > > > openjpa.Id: ode-dao > > > > openjpa.OrphanedKeyAction: log > > > > openjpa.FlushBeforeQueries: true > > > > openjpa.AutoClear : datastore > > > > openjpa.Compatibility: default > > > > openjpa.DetachState: loaded > > > > openjpa.jdbc.LRSSize: query > > > > openjpa.Multithreaded: false > > > > openjpa.FetchBatchSize: -1 > > > > openjpa.jdbc.SQLFactory: default > > > > openjpa.IgnoreChanges: false > > > > openjpa.jdbc.MappingDefaults: jpa > > > > openjpa.TransactionMode: local > > > > openjpa.RetryClassRegistration: false > > > > openjpa.jdbc.FetchDirection: forward > > > > openjpa.ClassResolver: default > > > > openjpa.LockTimeout: -1 > > > > openjpa.DataCacheTimeout: -1 > > > > openjpa.QueryCache: true > > > > openjpa.jdbc.DriverDataSource: simple > > > > openjpa.jdbc.TransactionIsolation: default > > > > openjpa.ProxyManager: default > > > > 29604 ode-dao TRACE [http-8080-Processor25] > > > openjpa.MetaData - Using > > > > metadata factory " > > > > > > > org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory@ > > > 1742ad8". > > > > 29604 ode-dao INFO [http-8080-Processor25] > > > openjpa.jdbc.JDBC - Using > > > > dictionary class > > "org.apache.openjpa.jdbc.sql.DerbyDictionary". > > > > WARN - > > > > > BPELDAOConnectionFactoryImpl$DebugTxMgr.getTransaction(130) | JPA > > > > get transaction WARN - > > > > > > BPELDAOConnectionFactoryImpl$DebugTx.registerSynchronization(179) | > > > > Synchronization registration on > > org.apache.openjpa.kernel.BrokerImpl > > > > WARN - > > > > > BPELDAOConnectionFactoryImpl$DebugTx.registerSynchronization(179) > > > > | Synchronization registration on > > > > > > > > > org.apache.openjpa.kernel.AbstractBrokerFactory$RemoveTransactionSync > > > > 29610 ode-dao INFO [http-8080-Processor25] > > > openjpa.MetaData - Found > > > > 13 > > > > classes with metadata in 0 milliseconds. > > > > 29834 ode-dao TRACE [http-8080-Processor25] > > openjpa.MetaData - > > > > Loading metadata for "class > > > > org.apache.ode.dao.jpa.MessageExchangeDAOImpl " under mode > > > > "[META][QUERY]". > > > > .......... > > > > .......... > > > > 30386 ode-dao TRACE [http-8080-Processor25] > > openjpa.jdbc.SQL - > > > 9601173, conn 16542562> executing prepstmnt 6493766 > > SELECT t0.ID, > > > > t0.VERSION, t0.GUID, t0.NUMBER_OF_INSTANCES, t0.PROCESS_ID, > > > > t0.PROCESS_TYPE FROM ODE_PROCESS t0 WHERE > > (t0.PROCESS_ID = ?) > > > > [params=(String) { > > http://ode/bpel/unit-test}HelloWorld2-1 > > ] > > > > 30387 ode-dao TRACE [http-8080-Processor25] > > openjpa.jdbc.SQL - > > > 9601173, conn 16542562> [0 ms] spent > > > > 30388 ode-dao TRACE [http-8080-Processor25] > > > openjpa.jdbc.JDBC - > > > 9601173, conn 16542562> [0 ms] close detached true WARN - > > > > BPELDAOConnectionFactoryImpl$DebugTxMgr.getTransaction(130) > > > | JPA get > > > > transaction ERROR - > > BpelServerImpl.bounceProcessDAO(334) | DbError > > > > <2|false|0.9.7-incubating-SNAPSHOT> > > > > org.apache.openjpa.persistence.EntityExistsException: > > > Attempt to persist > > > > detached object " > > org.apache.ode.dao.jpa.ProcessDAOImpl@c195e3". > > > > FailedObject: org.apache.ode.dao.jpa.ProcessDAOImpl@c195e3 > > > > at > > > > > > org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2346) > > > > at > > > > > > org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2204) > > > > at org.apache.openjpa.kernel.DelegatingBroker.persist( > > > > DelegatingBroker.java:991) > > > > at > > org.apache.openjpa.persistence.EntityManagerImpl.persist( > > > > EntityManagerImpl.java:525) > > > > at > > org.apache.ode.dao.jpa.BPELDAOConnectionImpl.createProcess( > > > > BPELDAOConnectionImpl.java:78) > > > > > > > > Thanks! > > > > Matthieu > > > > > > > ______________________________________________________________ > > > _________ > > > > Notice: This email message, together with any attachments, > > > may contain > > > > information of BEA Systems, Inc., its subsidiaries and > > > affiliated > > > > entities, that may be confidential, proprietary, > > > copyrighted and/or > > > > legally privileged, and is intended solely for the use of > > > the individual > > > > or entity named in this message. If you are not the > > > intended recipient, > > > > and have received this message in error, please immediately > > > return this > > > > by email and then delete it. > > > > > > > > > > > > > > > > ------=_Part_26372_32696660.1172775834643--