Hi, You are correct in detaching the instance with the current fetch plan. In theory, now the detached instance should only have the fields selected by the fetch plan. If that is not happening then verify the following in order 1. Is the instance detached? OpenJPAEntityManager.isDetached(pc) 2. What happens if you access and fields that is not supposed to be loaded in the detached instance? Configure openjpa.DetachState [1] with AccessUnloaded to throw an exception on any attempt to acess any unloaded field. 3. If the detached instane is serialized and deserialized, which fields in the deserialized object are populated? The above steps to ascertain that when JAXB is xmlizing the instance, inadvertently no fields are getting loaded as a side-effect.
You have to tell me more about the process that convertes these instances into XML -- such as when is this process is triggered? Which fields of the managed instance are processed by this XMLization process? Is there any possibility that a field will get loaded as a side-effect? Please note that any pc.getXXX() on a managed instance pc will load the field XXX. [1] http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_detach_behavior ----- Pinaki Poddar http://ppoddar.blogspot.com/ http://www.linkedin.com/in/pinakipoddar OpenJPA PMC Member/Committer JPA Expert Group Member -- View this message in context: http://n2.nabble.com/%27Masking%27-fields-in-an-Entity-tp2545263p2561243.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
