Sorry, I just read Guy's answer. Below is the URL of a nice article you can make good use of. Try a javax.Servlet.ServletContextListener better than init() in one of your servlets.
http://www.onjava.com/pub/a/onjava/2001/04/12/listeners.html Way off Torque now!, Álvaro. Ram <[EMAIL PROTECTED]> wrote: yes, i created a servlet and am loading it at start up. now its working fine.. On Dec 17, 2007 12:09 PM, Guy Galil wrote: > 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 > 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 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- cheers !! ramesh r --------------------------------- Never miss a thing. Make Yahoo your homepage.
