Hello dudes, i'm trying to make my beans lookup a database's conection, but the point here is make all of them see my jdbc/Datasource
Any idea?
Regards,
lottalava
-
How to make all EJB lookup a datasource? (2 messages)
- Posted by: Edson Alves Pereira
- Posted on: May 02 2006 13:35 EDT
Threaded Messages (2)
- How to make all EJB lookup a datasource? by abhishek bhargava on May 03 2006 06:29 EDT
- How to make all EJB lookup a datasource? by Edson Alves Pereira on May 08 2006 10:38 EDT
-
How to make all EJB lookup a datasource?[ Go to top ]
- Posted by: abhishek bhargava
- Posted on: May 03 2006 06:29 EDT
- in response to Edson Alves Pereira
One approach is to have an abstract class and define all your common methods for getting a database connection, ejbCreate() and other EJB lifecycle methods in the class. Next have all your EJB's extend this class so no need to write the same code in every EJB. -
How to make all EJB lookup a datasource?[ Go to top ]
- Posted by: Edson Alves Pereira
- Posted on: May 08 2006 10:38 EDT
- in response to abhishek bhargava
That´s ok, but may point here is about <resource-ref>, if i do what you wrote above, i still need to put a <resource-ref> in every bean inside my ejb-jar.xml, i´d like to create only one <resource-ref> to all beans, something like <resource-ref> in web.xml, to solve that i made a special bean where all others ask for database connections.