Search in sources :

Example 1 with Location

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

the class IdClassTest method testIdClassInSuperclass.

@Test
public void testIdClassInSuperclass() throws Exception {
    Tower tower = new Tower();
    tower.latitude = 10.3;
    tower.longitude = 45.4;
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    s.persist(tower);
    s.flush();
    s.clear();
    Location loc = new Location();
    loc.latitude = tower.latitude;
    loc.longitude = tower.longitude;
    assertNotNull(s.get(Tower.class, loc));
    tx.rollback();
    s.close();
}
Also used : Transaction(org.hibernate.Transaction) Tower(org.hibernate.test.annotations.id.sequences.entities.Tower) Session(org.hibernate.Session) Location(org.hibernate.test.annotations.id.sequences.entities.Location) Test(org.junit.Test)

Aggregations

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