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.
posted 10 years ago
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