Laird,
Yes, that was my first thought and in fact the original code path was calling some setters on Request. The first thing I did was to move those sets to after the call which creates the new Foo and contains the lookup of Bar that's triggering the constraint violation. Also because this method is a RequiresNew TX scope I am assuming the entity manager won't contain a scope of anything outside of what's occurring inside of the method. Beers are on me at JavaOne if we can figure this one out :-)
For reference I am in GF 3.2.1 with the associated Eclipselink from late 2011 I believe. Any thought on how to approach getting more info on the state of the PersistencrContext wrt this (without grabbing the src and stepping thru things :)?
Sent from my iPhone
That's interesting. You know, yes—some people don't—that the act of retrieving an object puts it in the persistence context? So if there's any modification to Request it will be "sent down" to the database, even if naively you thought you were just doing a query. I'm guessing you know this already but many of my teams over time have been burned by this.
Best,
Laird