Hi, I'm guessing it's a glitch with the debugger not properly recognizing the inserted or modified bytecodes from the enhancement process. I just looked at the OpenJPA code and we only insert a single pcVersionInit field. I don't see how anyone could get into this codepath more than once and not have a totally convoluted Entity class with multiple defined fields. Strange things can happen, but it doesn't look likely.
(BTW, your post mentioned pcInitVersion, but didn't you mean pcVersionInit? I don't see anything related to generating a pcInitVersion field in the Enhancer.) The exact same enhancement processing is performed regardless of whether it's build time or runtime enhancement. Is it possible for you to do a build time enhancement and then use some type of Java Decompiler to look at the enhanced class? If we see two pcVersionInit fields with that approach, then there's definitely a problem that needs to be resolved. Are you attempting to set the Version field yourself? You shouldn't be doing that. That should be under control of OpenJPA while updates are being made to the Entities. There isn't enough information to determine the detach issue... I don't know enough about the scenario to determine if this normal behavior or unexpected. It sounds unexpected to you, but I don't know from a JPA perspective... Kevin On Wed, Aug 29, 2012 at 9:08 AM, andyatmiami <stone...@gmail.com> wrote: > In debugging some OpenJPA code, I have found some strange behavior I am at > a > loss to explain. > > I am debugging JUnit tests in Eclipse using VM Arg > javaagent:<directory>/openjpa-2.2.0.jar to do runtime enhancement. > > Code for the constructor is: > > > > When I step into my constructor to create a JPA object, i notice there are > 2 > (!) pcVersionInit fields defined in the debugger. > > Why is this showing up 2x? > > Additionally, what is even stranger behavior I see during > initialization...In the constructor I have lines commented out that are > basically externalized in a fromJaxb() method. If the logic for the > property assignment happens directly in the constructor - then both > pcInitVersion fields are false. HOWEVER, if I call an external method to > perform the exact same logic - one of the pcInitVersion fields is false - > and another is set to true. Furthermore, I am then unable to persist this > object because OpenJPA things its a detached entity?! > > Any help would be appreciated. > > > > -- > View this message in context: > http://openjpa.208410.n2.nabble.com/pcVersionInit-exhibits-strange-behavior-tp7580968.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. >