That's what the DAO design pattern will do for you.
Look at Hibernate or iBatis or any other DAO project or implement your own
using JDBC.
-Tim

-----Original Message-----
From: Rajat Pandit [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 24, 2003 1:36 PM
To: [EMAIL PROTECTED]
Subject: Db usage in bean [design issue]


Hello all,
I am new to servlets development as such. And have this design issue. I
want to ensure that the applications that I build can be used with other
databases, which might have different tables or column names or
different structures on the whole.

I mean the basic buisness logic remains the same and other things around
it might change. This is what I am doing right now.

My Action - extended - Struts Action  -> the execute / perform method
calls the buisness logic bean.

The buisness logic bean is passed the connection resource (orginally
created in the action bean itself). 

This connection resource is used by the methods inside the bean for
getting their data.

I am not sure, but is there a possibility that I have buisness beans in
such a way that they don't have anytihng to do with the database
connection and all they need is data as arguments and return data back
_AND_ I am also don't need to clutter up my (extended) action class with
SQL fetches!.

This essentially means that there will be 
A. a buisness logic bean. Which contains the buisness logic to do
datamanipulation.
B. a database <put ur technical name here> bean which does the work of
fetching and returning back data to the db.
C. an extended action class which manages both of these.


All this might sound rather silly, but there are times when I really
drive my self nuts about keeping all the tiers clean and independent of
each other.

Can someone shed some light on this. (other alternatives being, turn on
the floodlights ;) )

Also any pointers on design patterns...

Rajat Pandit | [EMAIL PROTECTED]
+91 612 3117606
[ Developer and Part Time Human Being]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to