I need to create a session bean that will perform operations on backend database. I am new to EJB 3.0 and need a gentle guidance to the solution This is what I believe is suppose to be done
1. Create stateless bean interface marking operations. 2. Create bean implementation for above 3. Init stage will require me to connect to the Oracle database. Now am confused how will it get the connection details? Is there a way to extract the url username and password using resource bendle which can be accessed from within bean implementation? 4. Bean method will perform update, read oprations 5. Predestroy will close the connection 6. A client will simply call this ejb with some input parameter(s)
Please let me know if am doing anything wrong here
If you use EJB technology for which it is designed, the container (server) will manage the transaction (and also the connections to the database) for you, so no creation or cleanup of connections on your part. I advise you to read into JPA which is designed to be used in conjunction with EJB tech. The books Enterprise Javabeans 3.0 and Pro EJB 3: the Java Persistence API may help you a lot.