Yes, that's true for session and message-driven beans. The PostConstruct, PreDestroy, PrePassivate and PostActivate methods run in unspecified transaction and security contexts.
However, for Stateful session beans you have two minor differences:
- You can call EJBContext.getCallerPrincipal() and EJBContext.isCallerInRole().
- afterBegin() and beforeCompletion() are invoked with a transaction context. This is not the same for afterCompletion() which is invoked after the transacion has completed.
For entity beans (section 3.5 of the JPA specification):
When invoked from within a Java EE environment, the callback listeners for an entity share the enterprise naming context of the invoking component, and the entity callback methods are invoked in the transaction and security contexts of the calling component at the time at which the callback method is invoked.
[ September 08, 2008: Message edited by: Sergio Tridente ]