Hi Bryce, I started digging into you issue and quickly bumped into the "Multiple relationships of the same type" bug for which I posted the workaround. Then I got bogged down with unrelated stuff. I have definite plans to get back to your example today. Thanks for being patient, and sorry this is taking so long.
Max On Mon, Dec 7, 2009 at 11:35 PM, bcottam <bcot...@gmail.com> wrote: > Max, have you had a chance to try this out? I'm not trying to push or > anything, just wanted to make sure my last message didn't get > overlooked. I've noticed this error sort of... randomly popping up in > places where it preivously hasn't as of late. If i'm missing > something in my configuration, I'll be happy to change it, I'm just > not sure what I'm missing. > > again, I really appreciate your taking the time to help me debug this > issue. > > thanks, > -bryce > > On Dec 3, 4:46 pm, bryce cottam <bcot...@gmail.com> wrote: > > Okay, sorry for the delay, I haven't been able to focus on this for a few > days. > > > > here is the full (including the jar libararies in > > case there is an issue with them). > > > > http://www.resmarksystems.com/code/JdoTest.zip > > > > It's a very simple Servlet, by hitting the url hostname/jdotest you > > should execute the test case that is failing for me. > > > > I really appreciate your taking a look at this. I'm looking forward > > to getting it working. > > > > -bryce > > > > On Tue, Dec 1, 2009 at 10:15 PM, Max Ross (Google) > > > > <maxr+appeng...@google.com <maxr%2bappeng...@google.com>> wrote: > > > Just give me the smallest amount of compilable, runnable code that > > > demonstrates the incorrect behavior. A unit test is preferable because > I > > > can just drop it into my own test framework and run it, but I'll take > > > whatever format you can manage. > > > > > Thanks, > > > Max > > > > > On Tue, Dec 1, 2009 at 1:18 PM, bryce cottam <bcot...@gmail.com> > wrote: > > > > >> yeah, I didn't see a TransactionNotActiveException. > > >> here is my jdoconfig.xml: > > >> <persistence-manager-factory name="transactions-optional"> > > >> <property name="javax.jdo.PersistenceManagerFactoryClass" > > > > >> > value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/> > > >> <property name="javax.jdo.option.ConnectionURL" > value="appengine"/> > > >> <property name="javax.jdo.option.NontransactionalRead" > > >> value="true"/> > > >> <property name="javax.jdo.option.NontransactionalWrite" > > >> value="true"/> > > >> <property name="javax.jdo.option.RetainValues" value="true"/> > > >> <property name="datanucleus.appengine.autoCreateDatastoreTxns" > > >> value="true"/> > > >> </persistence-manager-factory> > > > > >> I think the only thing I changed was putting in this line: > > >> <property name="datanucleus.appengine.autoCreateDatastoreTxns" > > >> value="true"/> > > > > >> which may explain why I don't get the TransactionNotActiveException. > > >> So, for this unit test/servlet, you want me to just post the class > > >> file here, or strip down all my code and put up all my model classes > > >> and the test case/servlet code somewhere in a war or something? > > > > >> .... hmmmm I just commented out that line, and I still get the same > > >> behavior (i.e. I don't get the TransactionNotActiveException). Not > > >> sure what's going on. > > > > >> thanks, > > >> -bryce > > > > >> On Tue, Dec 1, 2009 at 2:04 PM, Max Ross (Google) > > >> <maxr+appeng...@google.com <maxr%2bappeng...@google.com>> wrote: > > >> > Now I'm starting to suspect something funny going on with your > config. > > >> > I > > >> > received a TransactionNotActiveException when I tried to run your > code > > >> > without starting the txn, and the fact that you didn't receive that > > >> > exception doesn't make any sense to me. I can't explain why you see > the > > >> > exception and I don't. The best thing would be for you to put > together > > >> > a > > >> > stripped down test case that demonstrates the problem. An actual > unit > > >> > test > > >> > would be ideal, but if you're not a position to write one then just > a > > >> > simple > > >> > standalone servlet should suffice. > > > > >> > Thanks, > > >> > Max > > > > >> > On Tue, Dec 1, 2009 at 1:00 PM, bryce cottam <bcot...@gmail.com> > wrote: > > > > >> >> that is both a type-o and it was missing :) It was missing from > my > > >> >> test code, but it was present in my "real" code. So, after putting > > >> >> the tx.begin() in the test code, I get the exact same behavior as > the > > >> >> "real" code (i.e. nothing gets written to the datastore and I get > the > > >> >> exception. Sorry about missing that in the code I posted. > > > > >> >> I'm kinda lost on where to go with this and where to look. I did > > >> >> notice that the code actually prompts the exception is in the > > >> >> datanucleus core and there is a comment above it that says: > > >> >> / TODO Factor out this PersistenceCapable reference > > >> >> ((PersistenceCapable)value).jdoCopyKeyFieldsFromObjectId(new > > >> >> AppIDObjectIdFieldConsumer(param, om, ps, > > >> >> javaTypeMappings), id); > > > > >> >> so, I'm not sure if this has soemthing to do with code style > > >> >> datanucleus is trying to phase out or what? Again, I'm not gonna > be > > >> >> shocked if I'm missing something though. > > >> >> thanks! > > >> >> -bryce > > > > >> >> On Tue, Dec 1, 2009 at 1:53 PM, Max Ross (Google) > > >> >> <maxr+appeng...@google.com <maxr%2bappeng...@google.com>> wrote: > > >> >> > I don't see a call to tx.begin() in the code below. Is that a > typo > > >> >> > or > > >> >> > is it > > >> >> > actually missing? > > > > >> >> > On Tue, Dec 1, 2009 at 12:29 PM, bryce cottam <bcot...@gmail.com > > > > >> >> > wrote: > > > > >> >> >> thanks so much for checking into this Max. > > > > >> >> >> The data that I'm saving is user generated, so there's not a set > > >> >> >> script for it. Conceptually what I'm doing is this: > > > > >> >> >> Bundle bundle = new Bundle(); > > > > >> >> >> bundle.setName("My Bundle"); > > >> >> >> bundle.setDescription(new > > >> >> >> com.google.appengine.api.datastore.Text("My Description")); > > >> >> >> bundle.setPricingModel(PricingModel.PER_GUEST); > > > > >> >> >> RatePlanratePlan= newRatePlan(); > > >> >> >> ratePlan.setPricingModel(PricingModel.PER_GUEST); > > >> >> >> ratePlan.setAdultPrice(new > > >> >> >> java.math.BigDecimal("300.00")); > > >> >> >> ratePlan.setYouthPrice(new > > >> >> >> java.math.BigDecimal("275.00")); > > > > >> >> >> bundle.setRatePlan(ratePlan); > > > > >> >> >> List<Key> activityIds = getActivityIds(); > > >> >> >> int i = 0; > > >> >> >> for (Key id : activityIds) { > > >> >> >> BundledActivity bundledActivity = new > > >> >> >> BundledActivity(); > > >> >> >> bundledActivity.setDay(++i); > > > > >> >> >> ActivityFK activityFk = new ActivityFK(); > > >> >> >> activityFk.setKey(id); > > >> >> >> activityFk.setName("activity " + i); > > > > >> >> >> activityFk.setPricingModel(PricingModel.PER_GUEST); > > > > >> >> >> bundledActivity.setActivity(activityFk); > > > > >> >> >> RatePlanactivityRate = newRatePlan(); > > > > >> >> >> activityRate.setPricingModel(PricingModel.PER_GUEST); > > >> >> >> activityRate.setAdultPrice(new > > >> >> >> java.math.BigDecimal("150.00")); > > >> >> >> activityRate.setYouthPrice(new > > >> >> >> java.math.BigDecimal("120.00")); > > > > >> >> >> > bundledActivity.setRatePlan(activityRate); > > >> >> >> > bundle.getActivities().add(bundledActivity); > > >> >> >> } > > > > >> >> >> PersistenceManager pm = PMF.createManager(); > > >> >> >> Transaction tx = pm.currentTransaction(); > > > > >> >> >> try { > > >> >> >> bundle = pm.makePersistent(bundle); > > >> >> >> tx.commit(); > > >> >> >> } > > >> >> >> finally { > > >> >> >> if (tx.isActive()) { > > >> >> >> tx.rollback(); > > >> >> >> } > > > > >> >> >> pm.close(); > > >> >> >> } > > > > >> >> >> I get the Bundle saved just fine, but when it tries to save it's > > >> >> >> child > > >> >> >> BundledActivity instances, it breaks. However, when I do the > same > > >> >> >> thing through the UI of my app, I get the error when attempting > to > > >> >> >> save the Bundle (i.e. nothing gets written to the datastore, > where > > >> >> >> as > > >> >> >> in this test code above, the parent Bundle is getting written, > but > > >> >> >> none of it's children are getting written). > > > > >> >> >> Of course anytime I post my code, I kind of summarize, there are > > >> >> >> utilities that I use etc. But I am able to reproduce the issue > > >> >> >> without using any of my "helper" apis. I am completely open to > just > > >> >> >> sending you my code (it's all proof of concept right now, so no > > >> >> >> disclosure issues) and you can see how all the pieces I'm using > are > > >> >> >> fitting together. > > > > >> >> >> I appreciate you taking a look at this, I'd love to know if I'm > > >> >> >> doing > > >> >> >> something wrong. > > >> >> >> thanks, > > >> >> >> -bryce > > > > >> >> >> On Tue, Dec 1, 2009 at 11:03 AM, Max Ross (Google) > > >> >> >> <maxr+appeng...@google.com <maxr%2bappeng...@google.com>> > wrote: > > >> >> >> > Hi Bryce, > > > > >> >> >> > Thanks for posting your model objects. I'm not able to > reproduce > > >> >> >> > the > > >> >> >> > exception you're reporting, but then again I'm just guessing > at > > >> >> >> > how > > >> >> >> > you're > > >> >> >> > populating your objects and persisting them. Here's what I > did: > > > > >> >> >> > Bundle b = new Bundle(); > > >> >> >> > RatePlanrp = newRatePlan(); > > >> >> >> > rp.setPricingModel(PricingModel.BOTH); > > >> >> >> > b.setRatePlan(rp); > > >> >> >> > b.setPricingModel(PricingModel.PER_GUEST); > > >> >> >> > BundledActivity ba = new BundledActivity(); > > >> >> >> > ba.setDay(3); > > >> >> >> > ActivityFK activityFK = new ActivityFK(); > > >> >> >> > activityFK.setName("harold"); > > >> >> >> > activityFK.setPricingModel(PricingModel.PER_UNIT); > > >> >> >> > ba.setActivity(activityFK); > > >> >> >> > RatePlananotherRatePlan = newRatePlan(); > > >> >> >> > ba.setRatePlan(anotherRatePlan); > > >> >> >> > b.getActivities().add(ba); > > >> >> >> > beginTxn(); > > > > ... > > > > read more ยป > > -- > > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.