>Struts uses a connection pool. So when you do a getConnection() you're
>actually pulling one out from a pool of shared connection objects, so
>there is no real problem with generating a new connection.
>In my application I have manager objects will deal with data beans, and
>these managers have methods that all look the same (open connection, select
>data, build bean, close up, return). Yes it's a lot of cut and paste. I'd
>prefer to have used EJBs but the project size doesn't warrant such expense
>(time and effort, not money).

Jim,

Instead of Struts connection pool management, I'm using WebLogic's. But that 
(hopefully) wouldn't cause a big difference.
I guess I got the design approach that you used. The managers (also called 
controllers) are the ones responsible for all the business logic, while also 
talking to the DAO (your data beans). But then, aren't we kind of breaking 
the idea of autonomous objects here? I mean, if you have a User object, this 
user should know how to save himself, how to retrieve it's own address, how 
to combine first and last name to return a full name (bad example of 
business logic this one, but will do for now!), etc.
I saw some time ago, a big system where they had business objects, DAOs for 
those business objects, and managers. Basically, the way they did it, the 
managers had all the business logic, creating business objects, DAOs 
whenever necessary. The business objects had no logic whatsoever, and where 
nothing more than simple value objects (or model objects if you wish).
It's one way to do it, it's just that I really feel like I'm doing a sin. :)

Regards,

Vanderlei
















_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

Reply via email to