This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB and JDBC

 
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
 
Don't listen to Steve. Just read this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!