Search in sources :

Example 1 with HibernateSequenceEntity

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

the class HibernateSequenceTest method testHibernateSequenceNextVal.

@Test
public void testHibernateSequenceNextVal() {
    Session session = openSession();
    Transaction txn = session.beginTransaction();
    HibernateSequenceEntity entity = new HibernateSequenceEntity();
    entity.setText("sample text");
    session.save(entity);
    txn.commit();
    session.close();
    Assert.assertNotNull(entity.getId());
}
Also used : Transaction(org.hibernate.Transaction) HibernateSequenceEntity(org.hibernate.test.annotations.id.sequences.entities.HibernateSequenceEntity) Session(org.hibernate.Session) Test(org.junit.Test)

Aggregations

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