• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB and JDBC  RSS feed

 
GaneshKumar Kumar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can I write the JDBC queries inside the business method of an Entity Bean or a Session Bean? Which Bean will be good for Writing JDBC queries?
Please let me know. I would appreciate If you could provide any link for the above.

Thanks.
Ganesh
 
paresh vernekar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You can write JDBC queries in both session as well as entity beans.However it depends on what you are trying to do with the queries.Session beans are used to represent a business process while entity beans represent an entity.If your JDBC queries span multiple entities you could use a session bean.With entity beans generally CMP is recomended, with the manipulation of data represented by them being done in the session bean.It is possible that with the use of EJB QL and entity beans you could achieve much of what you want without using JDBC queries

Hope this throws some light on your doubts.However whether to use JDBC queries or not, and whether to use them in session beans or entity beans is entirely a design decision

Regards,
Paresh Vernekar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!