Search in sources :

Example 1 with Store

use of org.hibernate.test.annotations.id.sequences.entities.Store in project hibernate-orm by hibernate.

the class IdTest method testClassLevelGenerator.

@Test
public void testClassLevelGenerator() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Store b = new Store();
    s.persist(b);
    tx.commit();
    s.close();
    assertNotNull(b.getId());
    s = openSession();
    tx = s.beginTransaction();
    s.delete(s.get(Store.class, b.getId()));
    tx.commit();
    s.close();
}
Also used : Transaction(org.hibernate.Transaction) Store(org.hibernate.test.annotations.id.sequences.entities.Store) Session(org.hibernate.Session) Test(org.junit.Test)

Aggregations

Session (org.hibernate.Session)1 Transaction (org.hibernate.Transaction)1 Store (org.hibernate.test.annotations.id.sequences.entities.Store)1 Test (org.junit.Test)1