my dog learned polymorphism
The moose likes EJB and other Java EE Technologies and the fly likes EJB and JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB and JDBC" Watch "EJB and JDBC" New topic


Sanjeev Shahi
Ranch Hand

Joined: Feb 26, 2001
Posts: 83
I am little confused, can anyone tell me where in ejb I'll write all the stuff related with JDBC like JDBC connection, preparedstatements etc.
Ruilin Yang
Ranch Hand

Joined: Jan 06, 2002
Posts: 150
In BMP entity beans, you need JBBC (SQL) code in the ejbCreate, ejbLoad, ejbStore, ejbRemove, ejbFind... methods (you may have more). Create an ejb means you insert a record into a database. Remove an Entity bean neans delete a record in a database.
In CMP entity bean you need do some code in the deployment descriptor (declairitively).
When using a session bean to connect to a database, you either put jdbc code in the bean's business methods or use a DAO to put JDBC code in the DAO.
Hope this will help
[ February 07, 2002: Message edited by: Rulin Yang ]
[ February 07, 2002: Message edited by: Rulin Yang ]
I agree. Here's the link:
subject: EJB and JDBC
It's not a secret anymore!