Hi, In working on the CTS, we've discovered some assumptions that cause OpenJPA to fail. The CTS obtains records via calls to getReference(), and then does some work with the objects.
The tests fail outright with default OpenJPA settings, as the openjpa.DetachState property defaults to 'loaded'. Instances obtained via getReference() have not yet been loaded, so there is no data available when the instances are detached. The tests can be made to pass by setting the openjpa.DetachState property to 'fgs', which causes OpenJPA to explicitly load all the fields in the default fetch group at detachment time. (Incidentally, this raised the issue being tracked with OPENJPA-103.) However, I'm not totally happy with the options available for the openjpa.DetachState setting. Currently, DetachState can take one of the three values: loaded: detached objects contain exactly the fields that have been loaded during the persistence context's life fgs: detached objects contain exactly the fields in the current fetch configuration at detach time all: detached objects are fully traversed at detach time I think that it'd be valuable to have a fourth option: loaded-and-fetch-groups. Using this setting, detached objects would have all the fields in the current fetch configuration, plus all the fields that the business code happened to access during the transaction. This is different than 'fgs' because 'fgs' will actually clear fields that are not in the current fetch configuration. It is different than 'loaded' because it will ensure that instances obtained via getReference() are hydrated prior to detachment. Thoughts? -Patrick -- Patrick Linskey BEA Systems, Inc. _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.