This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv 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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Question about @PostConstruct" Watch "Question about @PostConstruct" New topic

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)

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)"
jQuery in Action, 3rd edition
subject: Question about @PostConstruct
It's not a secret anymore!