-
Bug
-
Resolution: Done
-
Major
-
JBossAS-3.2.6 Final
-
None
SourceForge Submitter: javajedi .
The default interceptor stack for a CMP entity bean
includes a CachedConnectionInterceptor. This
interceptor is what gets returned from a call to
getPersistenceManager() on an EntityContainer. This
interceptor wraps the real persistence manager and
implements the EntityPersistenceManager interface.
However, it does not implement CMPPersistenceManager or
BMPPersistenceManager, and there is no method on it to
get at the real (wrapped) persistence manager. This
makes it impossible to call any methods specific to
CMPPersistenceManager or BMPPersistenceManager unless
you remove the CachedConnectionInterceptor from the
interceptor stack. I see 2 simple ways to solve this
problem.
1) Introduce a getRealPersistenceManager() method onto
CachedConnectionInterceptor. This is the quick and
nasty fix, since it breaks encapsulation.
2) Create CMPCachedConnectionInterceptor and
BMPCachedConnectionInterceptor subclasses of
CachedConnectionInterceptor that implement
CMPPersistenceManager and BMPPersistenceManager
respectively.
Of course there may be several other better solutions
that I just haven't thought of. If there is some
other, better way to get at the CMPPersistenceManager
instance on an entity bean, I would love to hear it. I
posted this question to the forums last week
(http://www.jboss.org/thread.jsp?forum=46&thread=32737)
and got no replies. Thanks.