db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Galil <guy_ga...@guardium.com>
Subject Re: Configure torque for struts
Date Mon, 17 Dec 2007 06:39:11 GMT
You need to initialize Torque only once at the beginning of your
application, We do it in the init() method of the first servlet we load
On Mon, 2007-12-17 at 08:17 +0530, Ram wrote:
> Well to be specific, I have configured the torque, generated the sql schema
> files and made it to run perfectly. I even tested using it inside  a main
> class like this.
> 
>  public static void main(String[] args) throws Exception
>     {
>     String path = "../crm/Torque.properties";
> 
>     Torque.init(path);
>     Contacts contacts = new Contacts();
>     contacts.setFirstname("Ramesh");
>     contacts.setLastname("R");
>     contacts.setMiddlename("n");
>     contacts.save();
>     }
> 
> But my purpose is to use it in struts. I am using it like this.
> 
> public ActionForward execute(ActionMapping mapping, ActionForm form,
>         HttpServletRequest request, HttpServletResponse response)
>         throws Exception
>     {
>     String path = "../crm/Torque.properties";
> 
>     Torque.init(path);
>     Contacts contacts = new Contacts();
>     contacts.setFirstname("xyz");
>     contacts.setLastname("s");
>     contacts.setMiddlename("n");
>     contacts.save();
>     request.setAttribute("Id", contacts.getPrimaryKey());
>     return mapping.findForward("success");
>     }
> Please guide whether am on a right track.
> 
> On Dec 17, 2007 7:54 AM, Alvaro Coronel <alvarocoronel67@yahoo.com> wrote:
> 
> > Hi Ramesh. If you can be more specific, it will be a lot easier to help
> > you. Tell us what you are trying to do, how you are trying and how it fails.
> >
> > Best regards,
> > Álvaro.
> >
> >
> >
> > Ramesh R <rameshchinnu61@gmail.com> wrote: Hi,
> >
> >
> >
> > I am using torque for struts application. I am currently finding difficult
> > configuring torque. Please guide me in how to do this.
> >
> >
> >
> >
> >
> > Thanks
> >
> >
> >
> > Ramesh r
> >
> >
> >
> >
> >
> >
> > ---------------------------------
> > Looking for last minute shopping deals?  Find them fast with Yahoo!
> > Search.
> >
> 
> 
> 


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


Mime
View raw message