just in case, the link to sun's very-worth-reading J2EE pattern page (Beta)
http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/

follow the J2EE Patterns Catalog link, register, then look for the
DataAccessObject Pattern under the Integration Tier Patterns

or if you are already a registered member of the Java Developer Connection,
go directly to
http://developer.java.sun.com/developer/restricted/patterns/DataAccessObject
.html

cheers,
nicolas b.



-----Original Message-----
From: Ritter, Steve [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 18, 2001 6:41 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Where do YOU put JDBC calls?


Ryan, you should really read the J2EE blueprints on DAO.  It covers
everything you need to know.

Search aroun javasoft.com for the blueprints (they are documents, not
software).

--Steve

-----Original Message-----
From: Ryan Cornia [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 18, 2001 7:36 AM
To: [EMAIL PROTECTED]
Subject: RE: Where do YOU put JDBC calls?


>From my understanding then -

I would have my Business Object class that wraps the table, lets call it
Address.
I would have a DAO object that is specific to that Business object for the
JDBC calls, lets call it AddressDAO.

In Address, I would have loadAddress, DeleteAddress, InsertAddress, all of
which would call AddressDAO to do the actual JDBC call?

Any simple examples of these two classes that are not EJB's? Is this the
route to go if I'm not using EJB's?

Thanks,
Ryan



>>> [EMAIL PROTECTED] 07/18/01 08:17AM >>>
Iam using the DAO(Data Access Object) design pattern for such Data access
situations. DAO is a layer of abstraction that works in conjunction with the
Business Object which is nothing but a container for business data. the
Business Object calls the DAO's business methods. The DAO's Business methods
wrap the JDBC Code for data base interaction. Its been explained clearly on
the J2EE blueprints section.Once you are done writing your DAO's, extend the
DAO into a session bean or use it seperately.

regards
pathangi r

-----Original Message-----
From: Ryan Cornia [ mailto:[EMAIL PROTECTED]]
<mailto:[EMAIL PROTECTED]]>
Sent: Wednesday, July 18, 2001 8:56 AM
To: [EMAIL PROTECTED]
Subject: Where do YOU put JDBC calls?



I'm wondering what people are considering best practices for JDBC calls?

I have been writing beans that wrap a database table, and include functions
"select", "insert", "delete". These functions either load the bean, insert
the bean values in the database, or delete the record from the database. In
all of these functions, I pass in a database connection from the action. (Or
whatever else is calling the bean.)

ie- public boolean select(Connection cn1, String primaryKey)

How are others doing it? I think this is a good approach, but want to see if
someone has come up with something better.

Thanks,
Ryan




Reply via email to