Okay, I think I've got something working now. I'd love it if somebody could explain why it works this way, however.
I created a simplified test case that did the following... 1. Persist an Object 2. Detach Object 3. Set Date field Null on Detached Object 4. Merge Detached Object 5. Verify Null Not Set Since the intent of the exercise was to avoid use of a detached state field, my entity annotations all include: @DetachedState(enabled=false) Running as such, a null value update is never merged back into the database. When I add the following property to my persistence.xml file, however, the change to null is picked up and merged successfully: <property name="openjpa.DetachState" value="fetch-groups" /> So basically none of my entities allow a detached state field, but by setting the openjpa.DetachState property to "field-groups" changes to null merged successfully. The reason for this behavior isn't exactly clear to me from the documentation. Anybody care to take a shot at explaining this in a little more detail? Thanks! -jmh On Fri, Aug 21, 2009 at 10:41 AM, Jason Hanna<jason.m.hanna.at.coincid...@gmail.com> wrote: > Right on. I'm thinking a basic field such as a date would always be > considered loaded. The documentation is a little ambiguous around this > point and I'm not quite ready to dig into the OpenJPA source code just > yet. > > I think posting a bug with a simplified test case is my next step, I > just wanted to make sure I wasn't completely mis-reading the > documentation before moving an issue report forward. > > -jmh > > On Fri, Aug 21, 2009 at 10:31 AM, Daryl Stultz<da...@6degrees.com> wrote: >> On Fri, Aug 21, 2009 at 10:18 AM, Jason Hanna < >> jason.m.hanna.at.coincid...@gmail.com> wrote: >> >>> fields that would have been included in the >>> detached state are treated as loaded, and will in turn set the >>> corresponding attached field to null. >>> >> >> I would say, if you think it's a bug, create a test case with an entity that >> defines a field that "would have been included in the detached state". >> Persist an instance, detach it, set the field to null, merge it, verify the >> null value in the database. The question for me is, what qualifies as a >> field that "would have been included in the detached state". I would think >> a Date would always be loaded. Of course, there is the scenario in which the >> entity is instantiated from a native query that doesn't select the Date >> field. Then it is truly unloaded and should not update the DB with null. >> >> -- >> Daryl Stultz >> _____________________________________ >> 6 Degrees Software and Consulting, Inc. >> http://www.6degrees.com >> mailto:da...@6degrees.com >> >