openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@bea.com>
Subject RE: Can I reuse instances?
Date Mon, 09 Apr 2007 19:41:09 GMT
> you need an instance.  In CMP the assumption is that entity 
> instances  
> are expensive to create, so less safe route and you pool them.   
> Reusing instances is really a CMP problem, but I don't think it can  
> be implemented without the help of the JPA engine.

... but it's not the JPA-visible itself that is necessarily going to be
heavyweight, these days. Maybe the proxies shepherding the instance
through the CMP lifecycle will be heavyweight, or certain fields in the
instance sourced from JNDI.

My point is that if you're seeing a performance penalty from creating
the actual instances themselves, I'd be interested in knowing what it
is, because potentially we could address that problem directly. If the
penalty is some other parts of the instantiation process, or the
fetching of the data from the database, well, that could be less
resolvable.

How are you coding the interaction between the (oh-so-wonderfully-named)
commit options and the JPA data cache?

-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. 

> -----Original Message-----
> From: Dain Sundstrom [mailto:dain@iq80.com] 
> Sent: Monday, April 09, 2007 11:11 AM
> To: open-jpa-dev@incubator.apache.org
> Subject: Re: Can I reuse instances?
> 
> On Apr 8, 2007, at 1:56 PM, Craig L Russell wrote:
> 
> > Hi Dain,
> >
> > I haven't looked in detail at the life cycle of CMP beans in a  
> > couple of years, but in general you can't simply keep the state of  
> > the underlying Entities through the life cycle. CMP beans are  
> > pooled and reused in transaction contexts and you have to load the  
> > state at specific points in the life cycle.
> 
> It depends on the commit option the container is using.  In commit  
> option A, you assume the cmp engine is the sole user of the 
> database,  
> so you don't need to load.  Normally people use commit option 
> B where  
> you keep instances activated with a specific primary key and reload  
> the data in each tx.
> 
> > Using the primary key stored in the CMP bean to do em.find at the  
> > appropriate time is the obvious way to take advantage of the em  
> > second level cache. To the extent that this is not efficient, we  
> > should fix it in the JPA layer not the CMP layer.
> 
> I would prefer to keep as much of the CMP stuff on the CMP side as  
> possible so the JPA implementation can focus on JPA issues.   One of  
> the assumption of JPA is that entities are light weight and cheap to  
> create, so you take the safe route and construct a new one 
> when every  
> you need an instance.  In CMP the assumption is that entity 
> instances  
> are expensive to create, so less safe route and you pool them.   
> Reusing instances is really a CMP problem, but I don't think it can  
> be implemented without the help of the JPA engine.
> 
> -dain
> 
> 
> 

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.

Mime
View raw message