users@glassfish.java.net

Re: _at_PostConstruct TransactionRequiredException

From: <glassfish_at_javadesktop.org>
Date: Mon, 01 Oct 2007 08:30:55 PDT

@PostConstruct is called after the bean has been created but before any methods on the bean have been called. Within the @PostConstruct callback you can not be guaranteed that the transaction will have been initialized. You may be able to create a User Transaction or call this bean from another bean but in general the timing of the transaction vs the injection/creation will be Server dependent.
A lazy init of the bean will probably be a better choice in this case.
--Gordon
[Message sent by forum member 'gyorke' (gyorke)]

http://forums.java.net/jive/thread.jspa?messageID=237835