You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Chen, Gin" <Gi...@NielsenMedia.com> on 2003/10/24 19:44:32 UTC

RE: [OT] Db usage in bean [design issue]

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:rajatp@centergroupinc.com] 
Sent: Friday, October 24, 2003 1:36 PM
To: struts-user@jakarta.apache.org
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 | rajatp@centergroupinc.com
+91 612 3117606
[ Developer and Part Time Human Being]


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: [OT] Db usage in bean [design issue]

Posted by Rajat Pandit <ra...@centergroupinc.com>.
Thanks tim (newbie here!!) I am looking into these products right now.
But what is torque then for. I am sorry if I am sounding so silly!. But
it all seems like a new land fr me. I come from php/java development
background.

-----Original Message-----
From: Chen, Gin [mailto:Gin.Chen@NielsenMedia.com] 
Sent: Friday, October 24, 2003 10:45 AM
To: 'Struts Users Mailing List'
Subject: RE: [OT] Db usage in bean [design issue]


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:rajatp@centergroupinc.com] 
Sent: Friday, October 24, 2003 1:36 PM
To: struts-user@jakarta.apache.org
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 | rajatp@centergroupinc.com
+91 612 3117606
[ Developer and Part Time Human Being]


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org