You can use constructors in your EJB's. The problem that you face is that
the environment and context that the bean will execute in is not defined.
So, you are not able to access the EJBContext, the EJBObject, resource
managers, client info, transaction info, or the local JNDI namespace.
Because of this, you generally don't want to do anything in a constructor.
It is usually better to put initialization code in the ejbCreate method(s),
or the ejbPostCreate method(s). The spec has a couple of tables that show
what operations are allowed in the various methods of the different flavor
beans and they all show that there is no access to anything in the EJB
environment in the constructor.
Bill
Post by pradeep tiwariHi All,
Can I use constructors in EJB(session,entity).If yes ,is there any restrictions.
Thanks In Advance