%BROADCASTMESSAGE%
CAAD | ARCH TWiki > Catch0405 > KaisersrotPersistenz > SoftwareVersions > TestExampleWithHibernate12 (r1.1) TWiki webs:
Admin| Aizo | Archinf | BIP | Bgyalex | Brandhub | Catch0405 | Cityscan05 | CommunityMedia | Control | Curtain | Easa005 | Easydb | Education | Extern | Extern0405 | Freudenhaus | Fund | Game0405 | Game05 | Gamearch | Luise | MAS0506 | MAS0506stu | Mas0506 | Mas0506stu | Maschinen0405 | Menz | Mill | Mill0405 | NDS | NDS0405 | NDS0405stu | Plugins | Qwipp | RZM | Replay | Replay0405 | Research | Second | Trash | Udintern | Urbandesign |
Catch0405 . { Changes | Index | Search | Go }
/*---------------------------------------------------------------------------

* running inserting pgm with hibernate 1.2.5

*

*

*----------------------------------------------------------------------------*/

public class HibernateTest? {

public static void main(String[] args) {

HibernateTest? hibernateTest = new HibernateTest?();

}

public HibernateTest?() {

Session session;

try {

//store data -----------------------------------------------------------------

Datastore ds = Hibernate.createDatastore();

ds.storeClass(User1.class);

// Then build a session to the database

SessionFactory? sf = ds.buildSessionFactory(); // or supply a Properties arg

session = sf.openSession();

// Create new User and store them the database

User1 newUser1 = new User1();

newUser1.setID("dr");

newUser1.setUserName("pia2 raschpichler");

// And the Hibernate call which stores it

session.save(newUser1);

// close our session and release resources

session.flush();

session.close();

} catch (MappingException? e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (HibernateException? e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

-- OtherDenisRaschpichler - 06 Dec 2004


Topic TestExampleWithHibernate12 . { Edit | Attach | Ref-By | Printable | Diffs | r1.2 | > | r1.1 | More }
Revision r1.1 - 06 Dec 2004 - 08:22 - OtherDenisRaschpichler
Parents: WebHome > KaisersrotPersistenz > SoftwareVersions

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.