This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Question about @PostConstruct Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Question about @PostConstruct" Watch "Question about @PostConstruct" New topic
Author

Question about @PostConstruct

Cainiao Zou
Ranch Hand

Joined: Mar 03, 2009
Posts: 36
Session Beans have a lifecycle callback function @PostConstruct, it's different than the class constructor, because it will be called later after dependence injection.
So my question is, can man call another EJB which is injected with @EJB in this lifecycle function and if yes, how about the transaction propagation? (JTA, CMT, transactional persistence context)

thanks
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

EJB 3.1 specification, p. 374, 13.6.5 wrote:The term "an unspecified transaction context" is used in the EJB specification to refer to the cases in which the EJB architecture does not fully define the transaction semantics of an enterprise bean method execution.

This includes the following cases:
(...)
- The execution of a PostConstruct, PreDestroy, PostActivate, or PrePassivate callback method of a session bean with container-managed transaction demarcation (Except Singleton PostConstruct/PreDestroy methods)"


OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
 
Consider Paul's rocket mass heater.
 
subject: Question about @PostConstruct
 
Similar Threads
Error in EJB 3.0 core specification?
Error in EJB 3.0 core specification?
EJB variable intialization
Lifecycle interceptors and transactions
bean's lifecycle callback method