Just code a business method in your CMP bean that opens a connection, does the SQL and whatever other business logic there might be, and as usual with JDBC, don't forget to make sure the connection is properly released(a finally clause with connection.close() or something similar).
And just in case(tough you probably know it already), if the business method doesn't really pertain to an individual instance of your CMP bean, then it's probably better to keep it outside of the CMP bean(like in a Session Bean). HTH, Juan Pablo Lorandi Chief Software Architect Code Foundry Ltd. [EMAIL PROTECTED] Barberstown, Straffan, Co. Kildare, Ireland. Tel: +353-1-6012050 Fax: +353-1-6012051 Mobile: +353-86-2157900 www.codefoundry.com > -----Original Message----- > From: A mailing list for Enterprise JavaBeans development > [mailto:[EMAIL PROTECTED]] On Behalf Of Kenneth D. Litwak > Sent: Tuesday, October 15, 2002 12:37 AM > To: [EMAIL PROTECTED] > Subject: JDBC from a CMP entity bean > > > Consider this scenario: > 1. I have a CMP bean. > 2. My requirements make it necesary for this CMP bean to > access data, say from a table, to build some value that is > not managed by he container, e.g., a Collection from another table. > 3. I don't want to use CMR (it looks really complicated > to use CMR, and I haven't seen a benefit at least equal to > the complexity). > > How can I do this? Use a DAO from the bean? Thanks. > > Ken > > ============================================================== > ============= > To unsubscribe, send email to [EMAIL PROTECTED] and > include in the body of the message "signoff EJB-INTEREST". > For general help, send email to [EMAIL PROTECTED] and > include in the body of the message "help". > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
