Michael - > While I still wonder about why detaching my entities doesn't reduce my heap memory usage You didn't mention what level of code you are running on, but if it is > 2.0, it might be a bug. Try setting the following property: <property name="openjpa.Compatibility" value="CopyOnDetach=false"/>
> also wonder whether there is a possibility for a query to return detached objects in the first place? I'm not aware of one. That doesn't mean the capability doesn't exist, I'm just not aware of it :) > Calling detach() for every object looks to be rather expensive Correct, in some of our performance testing we have found that detach is quite expensive. I put in a property LiteAutoDetach which is in place to quickly detach the entire persistence context, but unfortunately this optimization isn't available for detaching single instances. I know I missed an email you sent to this list a number of days ago where you were asking a very similar question. I don't want to derail this thread, but have you looked at large result sets[1]? The might simplify some of your loading code. [1] http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_dbsetup_lrs Thanks, Rick On Thu, Aug 11, 2011 at 2:06 AM, Michael Pflueger <michael.pflue...@sma.de>wrote: > Hi, > > While I still wonder about why detaching my entities doesn't reduce my heap > memory usage, > I also wonder whether there is a possibility for a query to return detached > objects in the first place? > This might be quite efficient for scenarios where you need to read lots of > data but not update it or need any other features of a managed entity. > Calling detach() for every object looks to be rather expensive, and above > method would not only avoid that but could possibly avoid some attachment > overhead aswell. > ___________________________________________________ > > SMA Solar Technology AG > Aufsichtsrat: Guenther Cramer (Vorsitzender) > Vorstand: Juergen Dolle, Roland Grebe, Uwe Hertel, Pierre-Pascal Urbon, > Marko Werner > Handelsregister: Amtsgericht Kassel HRB 3972 > Sitz der Gesellschaft: 34266 Niestetal > USt-ID-Nr. DE 113 08 59 54 > WEEE-Reg.-Nr. DE 95881150 > ___________________________________________________ > > -- *Rick Curtis*