Search in sources :

Example 1 with BreakDance

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

the class IdTest method testLowAllocationSize.

@Test
public void testLowAllocationSize() throws Exception {
    Session s;
    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    int size = 4;
    BreakDance[] bds = new BreakDance[size];
    for (int i = 0; i < size; i++) {
        bds[i] = new BreakDance();
        s.persist(bds[i]);
    }
    s.flush();
    for (int i = 0; i < size; i++) {
        assertEquals(i + 1, bds[i].id.intValue());
    }
    tx.rollback();
    s.close();
}
Also used : Transaction(org.hibernate.Transaction) BreakDance(org.hibernate.test.annotations.id.entities.BreakDance) Session(org.hibernate.Session) Test(org.junit.Test)

Aggregations

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