use of org.hibernate.cfg.Configuration in project hibernate-orm by hibernate.
the class BasicIntegratorTest method testNoAudited.
/**
* Tests that nothing crazy happens if the hibernate-envers jar happens
* to be on the classpath but we have no audited entities
*/
@Test
@TestForIssue(jiraKey = "HHH-9675")
public void testNoAudited() {
new Configuration().buildSessionFactory().close();
new Configuration().addAnnotatedClass(SimpleNonAuditedEntity.class).buildSessionFactory().close();
}
use of org.hibernate.cfg.Configuration in project hibernate-orm by hibernate.
the class CacheKeySerializationTest method getSessionFactory.
private SessionFactoryImplementor getSessionFactory(String cacheKeysFactory) {
Configuration configuration = new Configuration().setProperty(Environment.USE_SECOND_LEVEL_CACHE, "true").setProperty(Environment.CACHE_REGION_FACTORY, TestInfinispanRegionFactory.class.getName()).setProperty(Environment.DEFAULT_CACHE_CONCURRENCY_STRATEGY, "transactional").setProperty(AvailableSettings.SHARED_CACHE_MODE, "ALL").setProperty(Environment.HBM2DDL_AUTO, "create-drop");
if (cacheKeysFactory != null) {
configuration.setProperty(Environment.CACHE_KEYS_FACTORY, cacheKeysFactory);
}
configuration.addAnnotatedClass(WithSimpleId.class);
configuration.addAnnotatedClass(WithEmbeddedId.class);
return (SessionFactoryImplementor) configuration.buildSessionFactory();
}
use of org.hibernate.cfg.Configuration in project hibernate-orm by hibernate.
the class CacheKeysFactoryTest method getSessionFactory.
private SessionFactory getSessionFactory(String cacheKeysFactory) {
Configuration configuration = new Configuration().setProperty(Environment.USE_SECOND_LEVEL_CACHE, "true").setProperty(Environment.CACHE_REGION_FACTORY, TestInfinispanRegionFactory.class.getName()).setProperty(Environment.DEFAULT_CACHE_CONCURRENCY_STRATEGY, "transactional").setProperty(Environment.JPA_SHARED_CACHE_MODE, "ALL").setProperty(Environment.HBM2DDL_AUTO, "create-drop");
if (cacheKeysFactory != null) {
configuration.setProperty(Environment.CACHE_KEYS_FACTORY, cacheKeysFactory);
}
configuration.addAnnotatedClass(Person.class);
return configuration.buildSessionFactory();
}
use of org.hibernate.cfg.Configuration in project onebusaway-gtfs-modules by OneBusAway.
the class LongRouteDescriptionTest method setup.
@BeforeClass
public static void setup() throws IOException {
Configuration config = new Configuration();
config = config.configure("org/onebusaway/gtfs/hibernate-configuration.xml");
_sessionFactory = config.buildSessionFactory();
_dao = new HibernateGtfsRelationalDaoImpl(_sessionFactory);
GtfsReader reader = new GtfsReader();
reader.setInputLocation(new File("src/test/resources/org/onebusaway/gtfs/caltrain-long-route.zip"));
reader.setEntityStore(_dao);
reader.setDefaultAgencyId(_agencyId);
List<Class<?>> entityClasses = reader.getEntityClasses();
entityClasses.clear();
entityClasses.add(Agency.class);
entityClasses.add(Route.class);
reader.run();
}
use of org.hibernate.cfg.Configuration in project onebusaway-gtfs-modules by OneBusAway.
the class GtfsMappingTest method setup.
@Before
public void setup() throws IOException {
Configuration config = new Configuration();
config = config.configure("org/onebusaway/gtfs/hibernate-configuration.xml");
_sessionFactory = config.buildSessionFactory();
_dao = new HibernateGtfsRelationalDaoImpl(_sessionFactory);
_dao.open();
_reader = new GtfsReader();
_reader.setEntityStore(_dao);
}
Aggregations