Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Transaction is rolledback in ejbCreate(), ejbPostCreate(), or ejbRemove() and

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please clarify me the below doubt,

1. If the transaction is rolled back in any of the above three method, to which state bean will be moved? Is bean is moved to pooled state or method ready state.

2. In an entity bean, if the client gets the RuntimeException,
(1) can he continue with that EJBObject?
(2) Will the container creates new instance of the bean for the client?


Thanks in Advance
 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. If the transaction is rolled back in any of the above three method, to which state bean will be moved? Is bean is moved to pooled state or method ready state.
--- Can u tell which 3 methods you are talking about here? Since you are mentioning that transaction is getting rolled back, I assume that the bean is in method-ready state. In any case, the bean instance will be discarded/killed - goes to does-not-exist state.

2. In an entity bean, if the client gets the RuntimeException,
(1) can he continue with that EJBObject?
-- The bean instance will be killed. If the client still has reference to EJBObject and invokes methods on it, it receives java.rmi.NoSuchObjectException.

(2) Will the container creates new instance of the bean for the client?

-- Depends. If an instance is available in the pool, it can take one from there. Otherwise, a new instance will be created.
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Keerthi P:
1. If the transaction is rolled back in any of the above three method, to which state bean will be moved? Is bean is moved to pooled state or method ready state.
--- Can u tell which 3 methods you are talking about here? Since you are mentioning that transaction is getting rolled back, I assume that the bean is in method-ready state. In any case, the bean instance will be discarded/killed - goes to does-not-exist state.

2. In an entity bean, if the client gets the RuntimeException,
(1) can he continue with that EJBObject?
-- The bean instance will be killed. If the client still has reference to EJBObject and invokes methods on it, it receives java.rmi.NoSuchObjectException.

(2) Will the container creates new instance of the bean for the client?

-- Depends. If an instance is available in the pool, it can take one from there. Otherwise, a new instance will be created.




For Question 1 - I mean three methods are, ejbCreate(), ejbPostCreate(), or ejbRemove(). i.e. if the transaction is rolled back while executing any of these 3 methods.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Keerthi P:
1. If the transaction is rolled back in any of the above three method, to which state bean will be moved? Is bean is moved to pooled state or method ready state.

in the ejbCreate()/ejbPostCreate()/ejbRemove() methods in the case of an entity bean the instance will move from ready state to pooled state, If a transaction is rollback.

the following is an excerpt from the spec

the container will transition the instance to the pooled state. There are three possible
transitions from the ready to the pooled state: through the ejbPassivate() method,
through the ejbRemove() method, and because of a transaction rollback for ejbCreate(),
ejbPostCreate(), or ejbRemove()


2. In an entity bean, if the client gets the RuntimeException,
(1) can he continue with that EJBObject?
-- The bean instance will be killed. If the client still has reference to EJBObject and invokes methods on it, it receives java.rmi.NoSuchObjectException.

(2) Will the container creates new instance of the bean for the client?

-- Depends. If an instance is available in the pool, it can take one from there. Otherwise, a new instance will be created
 
Anderson gave himself the promotion. So I gave myself this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!