HOME       >>       Programming

Question On Enterprise Java Beans Answer me


Hi All, there's a question on ejb that i need to ask, the question is as follows:Is it necessary for an entity bean to protect itself against concurrent access from multiple transactions? Regards,Leo


Hope this answers your question:

In Entity bean deployment descriptor, we can define whether the bean is-reentrant or non-reentrant. If we define the entity bean as being reentrant, multiple clients can connect to the Entity bean & execute methods within the entity bean concurrently. Container takes care of synchronization. If we define the entity bean as non-reentrant and many clients connect to it concurrently to execute a method, exception is thrown.

Read complete discussion: http://www.jguru.com/faq/view.jsp?EID=35269


For transaction control in entity bean, it depends on whether you use CMT or BMT. If you use CMT (container-managed transaction), you need to write deployment descriptor on the concurrency access model for the container to use. This setting haven't specified in EJB spec, so it is now container specific (Websphere, Weblogic, JBoss... all use different descriptor syntax to deal with this). If you use BMT, you need to control it using JTA UserTransaction object, which is obtained from JNDI.


Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.