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:Read complete discussion: http://www.jguru.com/faq/view.jsp?EID=35269
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.
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.
|VIEW DESKTOP VERSION||REGISTER||GET FREE HOSTING|