You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ben Turner <be...@ultraworld.be> on 2004/02/15 13:26:34 UTC

persistent data storage - the right way

hello,

i have been looking (in vain) for a description how to implement database
access in struts correctly. i would like to use the DAO (data access object)
pattern in combination with datasources for connection pooling. however, i
am having a hard way figuring out how to implement the whole and to decouple
my actions from knowing about the implementation of the DB.

the example application bundled with struts uses a plugin to set up
everything in the application context - is this the right way to go about
things? i am planning on using postgresql for the moment but would like to
foresee possible changes in the future.

any examples or pointers in the right direction would be very much
appreciated.

thanks,

Ben.


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


Re: persistent data storage - the right way

Posted by Paul Thomas <pa...@tmsl.demon.co.uk>.
On 15/02/2004 12:26 Ben Turner wrote:
> hello,
> 
> i have been looking (in vain) for a description how to implement database
> access in struts correctly. i would like to use the DAO (data access
> object)
> pattern in combination with datasources for connection pooling. however,
> i
> am having a hard way figuring out how to implement the whole and to
> decouple
> my actions from knowing about the implementation of the DB.

The simple answer is that you don't. Struts has nothing to do with data 
persistence. What I think you're really asking is how to implement 
persistence in a web application.

> 
> the example application bundled with struts uses a plugin to set up
> everything in the application context - is this the right way to go about
> things? i am planning on using postgresql for the moment but would like
> to
> foresee possible changes in the future.

Well, I suppose you could use the Struts Datasource plug-in if you feel 
that's the way to go but I think you'll find most people use JNDI and the 
container-supplied connection pool.

-- 
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants         | 
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+

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


R: persistent data storage - the right way

Posted by Leonardo Francalanci <lf...@simtel.ie>.
I think that with hibernate you don't need to write sql
code to save/update/delete your objects or to retrieve
objects by their id, with ibatis you have to write
all your sql code.

Example with hibernate (pseudo-code...):

session.find(MyObject, id);
MyObject.setProp1(newvalue)
session.save() // automatically execute an update on your db

You don't have to write a line of sql with hibernate...
(except for queries like "select from MyObject where age>23")



Anyway I'm not a Guru, so I could be wrong...





> -----Messaggio originale-----
> Da: Mark Lowe [mailto:mark.lowe@talk21.com]
> Inviato: lunedi 16 febbraio 2004 11.09
> A: Struts Users Mailing List
> Oggetto: Re: persistent data storage - the right way
> 
> 
> One advantage hibernate has over ibatis is xdoclet support. You can 
> generate your mapping files from xdoclet comments which means that you 
> have the mappings and java code in the same place.
> Perhaps there's ibatisdoclet but I haven't noticed it. Other advantages 
> vs disadvantages I haven't a clue about as I've never used ibatis.
> 
> 
> 
> On 16 Feb 2004, at 04:11, David Friedman wrote:
> 
> > I use hibernate so, yes, I think it is a
> > good alternative. :)
> >
> > Regards,
> > David
> >
> > -----Original Message-----
> > From: lixin chu [mailto:lixin_chu@yahoo.com]
> > Sent: Sunday, February 15, 2004 8:56 PM
> > To: Struts Users Mailing List
> > Subject: Re: persistent data storage - the right way
> >
> >
> > is Hibernate another good alternative ?
> > --- Oliver Thiel <th...@gmx.de> wrote:
> >> Hi,
> >>
> >>
> >> you can use iBatis [http://www.ibatis.com/] and
> >> take a look at this example/tutorial:
> >> http://www.reumann.net/do/struts/ibatisLesson1
> >> (using: Struts - DAO - iBatis )
> >>
> >>
> >> I think this is what your looking for.
> >> Oliver
> >>
> >>
> >>> hello,
> >>>
> >>> i have been looking (in vain) for a description
> >> how to implement database
> >>> access in struts correctly. i would like to use
> >> the DAO (data access
> >>> object)
> >>> pattern in combination with datasources for
> >> connection pooling. however, i
> >>> am having a hard way figuring out how to implement
> >> the whole and to
> >>> decouple
> >>> my actions from knowing about the implementation
> >> of the DB.
> >>>
> >>> the example application bundled with struts uses a
> >> plugin to set up
> >>> everything in the application context - is this
> >> the right way to go about
> >>> things? i am planning on using postgresql for the
> >> moment but would like to
> >>> foresee possible changes in the future.
> >>>
> >>> any examples or pointers in the right direction
> >> would be very much
> >>> appreciated.
> >>>
> >>> thanks,
> >>>
> >>> Ben.
> >>>
> >>>
> >>>
> >>
> > ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail:
> >> struts-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail:
> >> struts-user-help@jakarta.apache.org
> >>>
> >>
> >> -- 
> >> GMX ProMail (250 MB Mailbox, 50 FreeSMS,
> >> Virenschutz, 2,99 EUR/Monat...)
> >> jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++
> >> http://www.gmx.net/derspiegel +++
> >>
> >>
> >>
> > ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> >> struts-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail:
> >> struts-user-help@jakarta.apache.org
> >>
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Finance: Get your refund fast by filing online.
> > http://taxes.yahoo.com/filing.html
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 

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


Re: persistent data storage - the right way

Posted by Mark Lowe <ma...@talk21.com>.
One advantage hibernate has over ibatis is xdoclet support. You can 
generate your mapping files from xdoclet comments which means that you 
have the mappings and java code in the same place.
Perhaps there's ibatisdoclet but I haven't noticed it. Other advantages 
vs disadvantages I haven't a clue about as I've never used ibatis.



On 16 Feb 2004, at 04:11, David Friedman wrote:

> I use hibernate so, yes, I think it is a
> good alternative. :)
>
> Regards,
> David
>
> -----Original Message-----
> From: lixin chu [mailto:lixin_chu@yahoo.com]
> Sent: Sunday, February 15, 2004 8:56 PM
> To: Struts Users Mailing List
> Subject: Re: persistent data storage - the right way
>
>
> is Hibernate another good alternative ?
> --- Oliver Thiel <th...@gmx.de> wrote:
>> Hi,
>>
>>
>> you can use iBatis [http://www.ibatis.com/] and
>> take a look at this example/tutorial:
>> http://www.reumann.net/do/struts/ibatisLesson1
>> (using: Struts - DAO - iBatis )
>>
>>
>> I think this is what your looking for.
>> Oliver
>>
>>
>>> hello,
>>>
>>> i have been looking (in vain) for a description
>> how to implement database
>>> access in struts correctly. i would like to use
>> the DAO (data access
>>> object)
>>> pattern in combination with datasources for
>> connection pooling. however, i
>>> am having a hard way figuring out how to implement
>> the whole and to
>>> decouple
>>> my actions from knowing about the implementation
>> of the DB.
>>>
>>> the example application bundled with struts uses a
>> plugin to set up
>>> everything in the application context - is this
>> the right way to go about
>>> things? i am planning on using postgresql for the
>> moment but would like to
>>> foresee possible changes in the future.
>>>
>>> any examples or pointers in the right direction
>> would be very much
>>> appreciated.
>>>
>>> thanks,
>>>
>>> Ben.
>>>
>>>
>>>
>>
> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:
>> struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:
>> struts-user-help@jakarta.apache.org
>>>
>>
>> -- 
>> GMX ProMail (250 MB Mailbox, 50 FreeSMS,
>> Virenschutz, 2,99 EUR/Monat...)
>> jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++
>> http://www.gmx.net/derspiegel +++
>>
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail:
>> struts-user-help@jakarta.apache.org
>>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
>
> ---------------------------------------------------------------------
> 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


RE: persistent data storage - the right way

Posted by David Friedman <hu...@ix.netcom.com>.
I use hibernate so, yes, I think it is a
good alternative. :)

Regards,
David

-----Original Message-----
From: lixin chu [mailto:lixin_chu@yahoo.com]
Sent: Sunday, February 15, 2004 8:56 PM
To: Struts Users Mailing List
Subject: Re: persistent data storage - the right way


is Hibernate another good alternative ?
--- Oliver Thiel <th...@gmx.de> wrote:
> Hi,
> 
> 
> you can use iBatis [http://www.ibatis.com/] and 
> take a look at this example/tutorial: 
> http://www.reumann.net/do/struts/ibatisLesson1
> (using: Struts - DAO - iBatis )
> 
> 
> I think this is what your looking for.
> Oliver
> 
> 
> > hello,
> > 
> > i have been looking (in vain) for a description
> how to implement database
> > access in struts correctly. i would like to use
> the DAO (data access
> > object)
> > pattern in combination with datasources for
> connection pooling. however, i
> > am having a hard way figuring out how to implement
> the whole and to
> > decouple
> > my actions from knowing about the implementation
> of the DB.
> > 
> > the example application bundled with struts uses a
> plugin to set up
> > everything in the application context - is this
> the right way to go about
> > things? i am planning on using postgresql for the
> moment but would like to
> > foresee possible changes in the future.
> > 
> > any examples or pointers in the right direction
> would be very much
> > appreciated.
> > 
> > thanks,
> > 
> > Ben.
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> > 
> 
> -- 
> GMX ProMail (250 MB Mailbox, 50 FreeSMS,
> Virenschutz, 2,99 EUR/Monat...)
> jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++
> http://www.gmx.net/derspiegel +++
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

---------------------------------------------------------------------
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: persistent data storage - the right way

Posted by lixin chu <li...@yahoo.com>.
is Hibernate another good alternative ?
--- Oliver Thiel <th...@gmx.de> wrote:
> Hi,
> 
> 
> you can use iBatis [http://www.ibatis.com/] and 
> take a look at this example/tutorial: 
> http://www.reumann.net/do/struts/ibatisLesson1
> (using: Struts - DAO - iBatis )
> 
> 
> I think this is what your looking for.
> Oliver
> 
> 
> > hello,
> > 
> > i have been looking (in vain) for a description
> how to implement database
> > access in struts correctly. i would like to use
> the DAO (data access
> > object)
> > pattern in combination with datasources for
> connection pooling. however, i
> > am having a hard way figuring out how to implement
> the whole and to
> > decouple
> > my actions from knowing about the implementation
> of the DB.
> > 
> > the example application bundled with struts uses a
> plugin to set up
> > everything in the application context - is this
> the right way to go about
> > things? i am planning on using postgresql for the
> moment but would like to
> > foresee possible changes in the future.
> > 
> > any examples or pointers in the right direction
> would be very much
> > appreciated.
> > 
> > thanks,
> > 
> > Ben.
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> > 
> 
> -- 
> GMX ProMail (250 MB Mailbox, 50 FreeSMS,
> Virenschutz, 2,99 EUR/Monat...)
> jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++
> http://www.gmx.net/derspiegel +++
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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


Re: persistent data storage - the right way

Posted by Oliver Thiel <th...@gmx.de>.
Hi,


you can use iBatis [http://www.ibatis.com/] and 
take a look at this example/tutorial: 
http://www.reumann.net/do/struts/ibatisLesson1
(using: Struts - DAO - iBatis )


I think this is what your looking for.
Oliver


> hello,
> 
> i have been looking (in vain) for a description how to implement database
> access in struts correctly. i would like to use the DAO (data access
> object)
> pattern in combination with datasources for connection pooling. however, i
> am having a hard way figuring out how to implement the whole and to
> decouple
> my actions from knowing about the implementation of the DB.
> 
> the example application bundled with struts uses a plugin to set up
> everything in the application context - is this the right way to go about
> things? i am planning on using postgresql for the moment but would like to
> foresee possible changes in the future.
> 
> any examples or pointers in the right direction would be very much
> appreciated.
> 
> thanks,
> 
> Ben.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 

-- 
GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++


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