new DAOException(e.getMessage());
> }finally{
> //do cleanup... like closing connections etc.
> }
> }
>
>
> regards
> Leon
>
>>
>> Do you catch this exception in the DAO method or do you throw it
>> outside?
>> When you throw it outside, the
regards
> Leon
>
> >
> > Do you catch this exception in the DAO method or do you throw it outside?
> > When you throw it outside, the local connection will be unclosed. What do
> > you to prevent such issues? Thanks in advance.
> >
> >
> >
> >
> &
connections etc.
> }
> }
>
>
> regards
> Leon
>
> >
> > Do you catch this exception in the DAO method or do you throw it outside?
> > When you throw it outside, the local connection will be unclosed. What do
> > you to prevent such issues? Thanks in adv
exception in the DAO method or do you throw it outside?
> When you throw it outside, the local connection will be unclosed. What do
> you to prevent such issues? Thanks in advance.
>
>
>
>
> -- Forwarded message --
> From: Larry Meadors <[EMAIL PROTECTED]&
vance.
-- Forwarded message --
From: Larry Meadors <[EMAIL PROTECTED]>
To: Struts Users Mailing List
Date: Thu, 13 Oct 2005 08:36:47 -0600
Subject: Re: Struts and db connections :: best practice
I would argue that a well-written struts application will *never* (at
least 99.
On Thu, October 13, 2005 12:37 pm, Dave Newton said:
> Frank W. Zammetti wrote:
>
>> Everyone else raised completely valid points about not doing what your
>> doing in an Action and why you shouldn't, so I'll just try and answer
>> the question :)
>
> Thus ending a fine and noble tradition.
>
> Boo
Frank W. Zammetti wrote:
Everyone else raised completely valid points about not doing what your
doing in an Action and why you shouldn't, so I'll just try and answer
the question :)
Thus ending a fine and noble tradition.
Booo, Frank, bo!
;)
Dave
I'm not sure about best practices, but I try to avoid database connections
in my actions. I tend to put this code in the model objects and let them
handle exceptions and so forth.
> Hi all,
> In a well written struts application, we assume declarative exception
> handling is used. Therefore the c
Everyone else raised completely valid points about not doing what your
doing in an Action and why you shouldn't, so I'll just try and answer
the question :)
* Wrap your call to getConnection() in a try block with only a finally:
try {
Connection con = getDataSource().getConnection();
}
Best practice has nothing to do w/ struts. On Struts wiki there are
several DAO's you can pick from.
Struts allows MVC layers, so that you can unit test each layer. For
example unit test the model and dao.
Even w/in a DAO... you never use a connection.
So I recommend you select a dao, and unit
Am I experiencing DejaVu?
Links that might interest you:
http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
(see Figure 9.1)
http://www.hibernate.org/
http://www.springframework.org/docs/ref
I would argue that a well-written struts application will *never* (at
least 99.999% of the time) have jdbc code in it.
Larry
On 10/13/05, emre akbas <[EMAIL PROTECTED]> wrote:
> Hi all,
> In a well written struts application, we assume declarative exception
> handling is used. Therefore the code
12 matches
Mail list logo