To be honest, this sort of thing has code smells to me. That bean sounds
like it's getting pretty complicated. I'd consider refactoring into a
JDO/DAO/CMR/Other Entity bean/etc. For the more seasoned containers CMR
isn't that new and might be worth a try.

From: Juan Pablo Lorandi <[EMAIL PROTECTED]>
Reply-To: Juan Pablo Lorandi <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: JDBC from a CMP entity bean
Date: Tue, 15 Oct 2002 01:04:16 +0100

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:EJB-INTEREST@;JAVA.SUN.COM] 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".

_________________________________________________________________
Choose an Internet access plan right for you -- try MSN!
http://resourcecenter.msn.com/access/plans/default.asp

===========================================================================
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".

Reply via email to