Honestly, I think the time you spend investing in Hibernate and Spring
(though you probably don't need spring yet) seems high up front, but you
quickly save it in overhead of writing JDBC style code which is slow
compared with Hibernate style code which goes very fast once you've got your
initial set up. You don't have to sit there writing
statement.setInt(1,MyObject.getId()); for all 20 fields in your table every
time you want to populate a statement. You just plug in your Hibernate
entity to a stripes form connected to an Action bean, and just call
MyObjectDao.save(MyObject); MyObjectDao.commit() and you're done. I've
written over 6000 lines of working code in the last two weeks and have a
website project well on it's way to functional with a dozen ActionBeans so
far, 25 or so Entities, and their DAOs, and a bunch of JSPs. At the start
of this project I had never used Hibernate at all, and had a basic
understanding of Spring. The Daoud books is an invaluable resource, and
doesn't take long to get through and introduces you to hooking Stripes up to
hibernate and spring, both of which are trivial.
Alex
On Sun, Nov 16, 2008 at 2:10 AM, Abhi <[EMAIL PROTECTED]> wrote:
> At this stage I am building a prototype (which is in a very nascent stage)
> and I do not have much experience with Spring. So did not explore Spring. As
> the complexity grows and I really feel the need of DI, for sure I am
> planning to use Spring. Right now I want to whip up the prototype as soon as
> possible.
>
> On Sun, Nov 16, 2008 at 3:46 AM, Oscar Westra van Holthe - Kind <
> [EMAIL PROTECTED]> wrote:
>
>> On 15-11-2008 at 15:54, Abhi 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?
>>
>> I like your Interceptor approach; it's exactly the way to do dependency
>> injection in action beans. I wonder though: is Spring really not an
>> option? There's no reason to reinvent the wheel.
>>
>>
>> Oscar
>>
>> --
>> ,-_ The more laws, the less justice.
>> /() )
>> (__ ( -- Marcus Cicero - "De Officiis" (44 B.C.)
>> =/ ()
>>
>> -------------------------------------------------------------------------
>> 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
>>
>
>
>
> --
> 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
>
>
-------------------------------------------------------------------------
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