Thanks for that Alex. I have a question regarding the usage of Spring and
Hibernate with Stripes.

If I use Spring, Hibernate and Stripes stack, can I test DB persistence
stand alone (As in from a main method)? I have used struts(1.2), Spring and
Hibernate stack before and there was no way (or maybe I did not know of one)
I could test stand alone.

On Sat, Nov 15, 2008 at 3:54 PM, Abhi <[EMAIL PROTECTED]> wrote:

> I have to acess a Database Connection object in my action bean. I am using
> plain old vanilla JDBC(no Spring and Hibernate). I am setting the DataSource
> object in ServletContext on application initialization and using this
> DataSource object to get a DB Connection object whenever I want.
>
> One approach that I can take is to get the Connection object directly from
> the ServletContext in my method and use it. But the problem with this
> approach is that I can't test my action bean stand alone (as the Connection
> object is taken from the ServletContext).
>
> To over come this I have provided a setter and getter for Connection in my
> action bean and I use an Interceptor to inject the Connection object into my
> bean before HandlerResolution life cycle stage. The advantage of this is,
> now I can test my bean stand alone by setting my own Connection object and
> when it runs inside a servlet container Stripes does the injection for me.
> To close the connection also I am using an intercptor that closes the
> connection after ResolutionExecution life cycle stage.
>
> Is my approach correct or is there a better way to achieve what I want?
>
> --
> Cheers,
> Abhi
>



-- 
Cheers,
Abhi
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to