openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: Custom proxy : idea review needed
Date Tue, 04 Aug 2009 01:06:35 GMT

Hi,

Have you tried detaching your entities? When an entity is detached OpenJPA
won't go to the database to load a field. So we'll return null for anything
that isn't in your fetch group (exception : if you load the field prior to
detaching then it will be available).

You can detach by calling EntityManager.clear() or
OpenJPAEntityManager.detach(Object o). Either way it'll be a lot easier than
creating your own proxy class.  

Hope this helps,
-mike


Jean-Baptiste BRIAUD -- Novlog wrote:
> 
> Hi,
> 
> My question is "is there simpler things to do ?"
> Please, review that idea and don't hesitate to comment ...
> 
> Step 1 : I want partial object, not hashtables. It could be a Person  
> with only some attributes having values.
> this concern not only @Basic attribute but also any relational  
> attributes like @ManyToOne, ...
> => I used fetch plan and it works fine.
> 
> Step 2 : I'm using an Apache lib via a third party framework that  
> explore all accessors (beanutils).
> Unfortunatly, unretreived attributes came with a proxy.
> As a consequence, all unreitreived attributes are now retreived  
> wasting all the benefit of having used fetch plan ...
> 
> Step 3 : I first try to get rid of that proxies but without success,
> so I though I could just have my own proxy that could subclass the  
> OpenJPA default proxy
> and just ensure in my subclass that when I need no proxy, the default  
> behavior is bypassed.
> 
> What do you think about that idea ?
> 
> 

-- 
View this message in context: http://n2.nabble.com/Custom-proxy-%3A-idea-review-needed-tp3376839p3381672.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message