TWiki . Catch0405 . Store-Data

* TODO To change the template for this generated file go to
 * Window - Prefere nces - Java - Code Style - Code Templates
 */

/**
 * @author denis
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class StoreData {
   String store(String [] s) {

      try {

         //      Create the SessionFactory
         Configuration cfg = new Configuration().addClass(StoreTupel.class);
         SessionFactory factory = cfg.buildSessionFactory();
         //      Create the Session
         Session session = factory.openSession();
         //      Create the Transaction               
         Transaction tx = session.beginTransaction();

         //Create new User and store them the database
         StoreTupel storeTupel = new StoreTupel();
         //newUser1.setID("dr");
         storeTupel.setName(s[0]);
         storeTupel.setGeschlecht(s[1]);
         storeTupel.setAlter(s[2]);
         storeTupel.setBeruf(s[3]);
         storeTupel.setE_mail(s[4]);
         storeTupel.setTypGruppe(s[5]);
         storeTupel.setHausTyp(s[6]);
         storeTupel.setSize(s[7]);
         storeTupel.setAccessoires(s[8]);
         storeTupel.setPosVH(s[9]);
         storeTupel.setPosLR(s[10]);
         storeTupel.setGartenTyp(s[11]);
         storeTupel.setNStrasse(s[12]);
         storeTupel.setNBus(s[13]);
         storeTupel.setNWasser(s[14]);
         storeTupel.setNWald(s[15]);
         storeTupel.setNMarkt(s[16]);
         storeTupel.setNNachbar(s[17]);
         storeTupel.setNachbarName(s[18]);
         
         session.save(storeTupel);
         tx.commit();

         // close our session and release resources
         session.flush();
         session.close();
                  
      } catch (HibernateException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      String returnString = "store successfully completed";
      return (returnString);
   }
}

-- OtherDenisRaschpichler - 15 Dec 2004

----- Revision r1.1 - 15 Dec 2004 - 21:19 - OtherDenisRaschpichler
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

This website has been archived and is no longer maintained.