Search in sources :

Example 6 with Citizen

use of org.hibernate.test.cache.infinispan.functional.entities.Citizen in project hibernate-orm by hibernate.

the class ReadWriteTest method saveSomeCitizens.

private List<Citizen> saveSomeCitizens() throws Exception {
    final Citizen c1 = new Citizen();
    c1.setFirstname("Emmanuel");
    c1.setLastname("Bernard");
    c1.setSsn("1234");
    final State france = new State();
    france.setName("Ile de France");
    c1.setState(france);
    final Citizen c2 = new Citizen();
    c2.setFirstname("Gavin");
    c2.setLastname("King");
    c2.setSsn("000");
    final State australia = new State();
    australia.setName("Australia");
    c2.setState(australia);
    withTxSession(s -> {
        s.persist(australia);
        s.persist(france);
        s.persist(c1);
        s.persist(c2);
    });
    List<Citizen> citizens = new ArrayList<>(2);
    citizens.add(c1);
    citizens.add(c2);
    return citizens;
}
Also used : State(org.hibernate.test.cache.infinispan.functional.entities.State) ArrayList(java.util.ArrayList) Citizen(org.hibernate.test.cache.infinispan.functional.entities.Citizen)

Aggregations

Citizen (org.hibernate.test.cache.infinispan.functional.entities.Citizen)6 State (org.hibernate.test.cache.infinispan.functional.entities.State)4 Test (org.junit.Test)3 Cache (org.hibernate.Cache)2 SecondLevelCacheStatistics (org.hibernate.stat.SecondLevelCacheStatistics)2 Statistics (org.hibernate.stat.Statistics)2 ArrayList (java.util.ArrayList)1 Criteria (org.hibernate.Criteria)1 NaturalIdLoadAccess (org.hibernate.NaturalIdLoadAccess)1