Menu

#493 ejbLoad not called with commit option C

v3.0 Rabbit Hole
closed-wont-fix
5
2003-10-05
2002-05-02
No

ejbLoad() is not always called when invoking a method
on an entity bean with commit option C (doesn't matter
if BMP or CMP). See discussion at
http://jboss.org/forums/thread.jsp?
forum=46&thread=7066 and example code in the
attachment.

The problem only occurs when invoking methods
*outside* a transaction. The
EntitySynchronizationInterceptor then cannot
invalidate or remove the bean from the cache in
afterCompletion().

When running the demo from the attachment, be sure to
set commit option to C for Standard BMP Entity Bean in
standardjboss.xml.

I've verified this behavior with JBoss 2.4.0 and 3.0.0
with JDK 1.3.1 under Windows 2000.

Discussion

  • Anonymous

    Anonymous - 2002-05-02

    simple BMP bean and test client to verify the bug

     
  • Dain Sundstrom

    Dain Sundstrom - 2002-08-24
    • assigned_to: nobody --> patriot1burke
     
  • Dain Sundstrom

    Dain Sundstrom - 2002-08-24

    Logged In: YES
    user_id=251431

    Bill did you already fix this?

     
  • Adrian Brock

    Adrian Brock - 2003-04-22
    • assigned_to: patriot1burke --> ejort
    • status: open --> open-remind
     
  • Adrian Brock

    Adrian Brock - 2003-04-22

    Logged In: YES
    user_id=9459

    I have fixed the option B version of this problem.

    This does not work correctly for option C.

    Under 3.0 the return to pool could fail since it is done
    in a background thread. It depends on the timing,
    sometimes it just goes back in the cache.

    Under 3.2 the bean is never returned to the pool because
    the context is always locked when it is attempted.
    The bean is discarded so at least ejbLoad is invoked.

    see org.jboss.test.entity.test.EJBLoadUnitTestCase

    Regards,
    Adrian

     
  • Adrian Brock

    Adrian Brock - 2003-10-05
    • status: open-remind --> closed-wont-fix
     
  • Adrian Brock

    Adrian Brock - 2003-10-05

    Logged In: YES
    user_id=9459

    I have fixed commit C inside a transaction so it can now
    return beans to the pool in 3.2

    Fixing outside a transaction is not possible in general.
    There is no transactional lock or demarcation when we know
    for definite the context is not being used.

    The reason it does not work even with one thread,
    is because the EntityLockInterceptor
    holds a reference to the lock as well as the cache.
    The cache will only passivate a bean when it is has the sole
    reference on the bean.

    You can use "instance-per-transaction" to get the behaviour
    you are looking for. Each invocation uses its own copy of the
    bean.

    Regards,
    Adrian

     

Log in to post a comment.