You might want to take a look at Java Data Objects (JDO) specification (http://access1.sun.com/jdo/).  The RI has been released.  It's also supported in Forte (http://www.sun.com/forte/ffj/resources/articles/transparent.html  http://www.sun.com/forte/ffj/resources/articles/jdo.html), and I suspect that Netbeans has or will soon get a JDO module.
 
There is an open source implementation as part of the JBoss project, see http://www.jboss.org/jboss-castor.jsp for details.
 
Using JDO saves you from having to code SQL, but more than that it provides deployment time binding of your classes to the underlying database schema.  No more code changes when the DBA's change the column names, etc!
 
-----Original Message-----
From: Ryan Cornia [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 00:36
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]]
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