Search in sources :

Example 1 with Department

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

the class IdTest method testMethodLevelGenerator.

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

Aggregations

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