Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 62316 invoked from network); 27 May 2010 18:04:35 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 May 2010 18:04:35 -0000 Received: (qmail 81410 invoked by uid 500); 27 May 2010 18:04:35 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 81383 invoked by uid 500); 27 May 2010 18:04:35 -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 81361 invoked by uid 99); 27 May 2010 18:04:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 May 2010 18:04:35 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [161.184.168.147] (HELO mail.adamsbros.org) (161.184.168.147) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 May 2010 18:04:28 +0000 Received: from zimbra.adamsbros.org (zimbra.adamsbros.org [192.168.20.70]) by mail.adamsbros.org (Postfix) with ESMTP id 004272E8B84; Thu, 27 May 2010 11:08:40 -0600 (MDT) Date: Thu, 27 May 2010 11:08:40 -0600 (MDT) From: "Trenton D. Adams" To: "Trenton D. Adams" Cc: users@openjpa.apache.org, cnd@cndavies.com Message-ID: <1675460918.121274980120902.JavaMail.root@zimbra> In-Reply-To: <1672864109.31274979267737.JavaMail.root@zimbra> Subject: Re: openjpa-1.2.1 partial commit problem MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.20.51] X-Mailer: Zimbra 5.0.11_GA_2695.RHEL5_64 (ZimbraWebClient - FF3.0 (Linux)/5.0.11_GA_2695.RHEL5_64) X-Virus-Checked: Checked by ClamAV on apache.org Oh, I didn't do it on all of the objects though, just the main one, but I don't think it will make a difference. I'll try though. ----- "Trenton D. Adams" wrote: > From: "Trenton D. Adams" > To: cnd@cndavies.com > Cc: "Trenton D. Adams" , users@openjpa.apache.org > Sent: Thursday, May 27, 2010 10:54:27 AM GMT -07:00 US/Canada Mountain > Subject: Re: openjpa-1.2.1 partial commit problem > > Yes, I did, but it revealed nothing more than I already knew, which is > why I didn't mention it. One of my entries that I added got in to the > database, but only that one. If you notice the third one down, the > entryID has been set, but the second entryID is still 0. > > prePersist this: JournalEntry{journalNumber=0, > journalType='JournalType{journalType='General', description='null'}', > journalDescription='pre commit entry', ledgerEntries=[]} > > postPersist this: JournalEntry{journalNumber=327, > journalType='JournalType{journalType='General', description='null'}', > journalDescription='pre commit entry', ledgerEntries=[]} > > preUpdate this: JournalEntry{journalNumber=327, > journalType='JournalType{journalType='General', description='null'}', > journalDescription='new test entry', ledgerEntries=[ > [entryID = 0, entryType = CREDIT, description = debit bank account, > amount = 342.00, dateTime = nullTnull], > [entryID = 0, entryType = DEBIT, description = paper, pens, etc, > amount = 342.00, dateTime = nullTnull]]} > > postUpdate this: JournalEntry{journalNumber=327, > journalType='JournalType{journalType='General', description='null'}', > journalDescription='new test entry', ledgerEntries=[ > [entryID = 130, entryType = CREDIT, description = debit bank account, > amount = 342.00, dateTime = 2010-05-27T03:53:14], > [entryID = 0, entryType = DEBIT, description = paper, pens, etc, > amount = 342.00, dateTime = nullTnull]]} > > postLoad this: JournalEntry{journalNumber=327, > journalType='JournalType{journalType='General', description='General > Journal'}', journalDescription='new test entry', ledgerEntries=[ > [entryID = 130, entryType = CREDIT, description = debit bank account, > amount = 342, dateTime = 2010-05-27T03:53:14]]} > > ----- "C N Davies" wrote: > > > From: "C N Davies" > > To: "Trenton D. Adams" , > users@openjpa.apache.org > > Sent: Thursday, May 27, 2010 3:56:33 AM GMT -07:00 US/Canada > Mountain > > Subject: RE: openjpa-1.2.1 partial commit problem > > > > Have you added a Prepersist and PreUpdate listeners? I think it > will > > assist in troubleshooting, I use it so I can log the state of the > > entity, here is my example. > > > > > > /** > > * Creates the. > > */ > > @PrePersist > > public void create(){ > > if (this.createdate==null) > > this.setCreatedate(new Date()); > > this.setUpdatedate(new Date()); > > this.defaultUID(); > > Log.debug(Sysutil.dumpCO(this)); > > } > > > > /** > > * Update. > > */ > > @PreUpdate > > public void update(){ > > this.setUpdatedate(new Date()); > > this.defaultUID(); > > Log.debug(Sysutil.dumpCO(this)); > > } > > > > -----Original Message----- > > From: Trenton D. Adams [mailto:trent@trentonadams.ca] > > Sent: Thursday, 27 May 2010 6:44 PM > > To: users@openjpa.apache.org > > Cc: cnd@cndavies.com > > Subject: Re: openjpa-1.2.1 partial commit problem > > > > Okay, now that I have build time enhancement working, I have still > not > > identified anything that should cause a problem. > > > > All I do is remove a single entityManager.flush() call from my EJB, > > and voila, the problem is gone. But, I put the flush back in, it > adds > > one of the records from the list, and not the other; no errors, > just > > doesn't finish adding the whole collection. > > > > ----- "Trenton D. Adams" wrote: > > > > > From: "Trenton D. Adams" > > > To: users@openjpa.apache.org, cnd@cndavies.com > > > Sent: Thursday, May 27, 2010 1:04:09 AM GMT -07:00 US/Canada > > Mountain > > > Subject: Re: openjpa-1.2.1 partial commit problem > > > > > > Oh, I definitely want to do that, now that I know about it. Just > > > waiting for a response on my other topic. I'm thinking it's > > probably > > > related to some sort of annotation that I need to do on my enum, > > but > > > don't know what. > > > > > > ----- "C N Davies" wrote: > > > > > > > From: "C N Davies" > > > > To: users@openjpa.apache.org > > > > Sent: Thursday, May 27, 2010 12:25:14 AM GMT -07:00 US/Canada > > > Mountain > > > > Subject: RE: openjpa-1.2.1 partial commit problem > > > > > > > > Use prepersist / preupate listeners, you can check the content > of > > > your > > > > objects inside there. > > > > > > > > Trust me, you would be better to spend your time working out > why > > > build > > > > time enhancement blows up one of your objects, as I mentioned > > > before > > > > and Pinaki re-iterated runtime enhancement will often cause > > issues > > > > that manifest themselves nowhere near the root cause of the > > issue. > > > I > > > > would not be all surprise if your issue does related to run > time > > > > enhancement. I went down the road of relying on run time > > > enhancement > > > > for months so I din't have to worry about setting up ant, I > saved > > > time > > > > not having to work on ant but I lost 10 times the time trying > to > > > sort > > > > out strange issues that never made any sense but turned out to > be > > > the > > > > runtime enhancer. If it was up to me I'd remove it completely > > > > > > > > Chris > > > > > > > > > > > > -----Original Message----- > > > > From: Trenton D. Adams [mailto:trent@trentonadams.ca] > > > > Sent: Thursday, 27 May 2010 2:41 PM > > > > To: openjpa-users > > > > Subject: openjpa-1.2.1 partial commit problem > > > > > > > > Hi Guys, > > > > > > > > I am not yet using the build time enhancer, as it currently > blows > > > up > > > > on one of my objects, as noted in another message to the list. > > So, > > > > it's sticking to runtime subclassing. > > > > > > > > I'm having the oddest problem. I am using EJB3, and have a > > method > > > > that REQUIRES_NEW for the transaction. It works fine like > that, > > > but > > > > as soon as I remove that attribute, to get the default > > transaction > > > > attribute, my records are only partially committed, literally. > > > > > > > > So, what I'm trying to do, is > > > > 1. put a journal entry in with the message "pre commit entry" > in > > > it's > > > > own transaction, to make sure something is entered in, in case > > > > something happens that blows up the rest of the commit process. > > > > That > > > > way someone knows why the serial column has a missing journal > > > number. > > > > 2. add some entity objects to the journal entry, as a > collection > > > > 3. merge the journal entry again with objects in the collection > > > > > > > > That's fine, but I decided to remove the REQUIRES_NEW, just to > > see > > > if > > > > my unit tests would fail. I found out really quickly that only > > one > > > > item of the collection is being persisted to the database. > > > > > > > > I am effectively going like this (pseudo code)... > > > > > > > > --- method with REQUIRES_NEW > > > > entityManager.persist(journalEntry); > > > > entityManager.flush(); // if this flush is > removed, > > it > > > > works without REQUIRES_NEW, but not otherwise. > > > > > > > > --- method that calls method with REQUIRES_NEW > > > > journalEntry = new JournalEntry( > > > > ledgerBroker.getJournalType(), "pre commit > > entry"); > > > > sessionContext.getBusinessObject( > > > > > > > RIJournalEntryManager.class).persistMethod(journalEntry); > > > > journalEntry.addItem(blah); > > > > journalEntry.addItem(blah); > > > > entityManager.merge(journalEntry); > > > > entityManager.flush(); > > > > > > > > It seems to me that this is a bug in openjpa, but I cannot be > > > certain, > > > > as I'm VERY new to EJB/JPA.