Search in sources :

Example 46 with ISessionFactory

use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewHQLQueryPlan.

@Test
public void testNewHQLQueryPlan() throws Exception {
    IConfiguration configuration = service.newDefaultConfiguration();
    configuration.setProperty(AvailableSettings.DIALECT, TestDialect.class.getName());
    File testFile = File.createTempFile("test", "tmp");
    testFile.deleteOnExit();
    FileWriter fileWriter = new FileWriter(testFile);
    fileWriter.write(TEST_HBM_STRING);
    fileWriter.close();
    configuration.addFile(testFile);
    ISessionFactory sfi = configuration.buildSessionFactory();
    IHQLQueryPlan queryPlan = service.newHQLQueryPlan("from ServiceImplTest$Foo", true, sfi);
    assertNotNull(queryPlan);
    Object target = ((IFacade) queryPlan).getTarget();
    assertNotNull(target);
    assertTrue(target instanceof HQLQueryPlan);
}
Also used : HQLQueryPlan(org.hibernate.engine.query.spi.HQLQueryPlan) IHQLQueryPlan(org.jboss.tools.hibernate.runtime.spi.IHQLQueryPlan) FileWriter(java.io.FileWriter) ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) IHQLQueryPlan(org.jboss.tools.hibernate.runtime.spi.IHQLQueryPlan) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 47 with ISessionFactory

use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testBuildSessionFactory.

@Test
public void testBuildSessionFactory() throws Throwable {
    ISessionFactory sessionFactoryFacade = configurationFacade.buildSessionFactory();
    assertNotNull(sessionFactoryFacade);
    Object sessionFactory = ((IFacade) sessionFactoryFacade).getTarget();
    assertNotNull(sessionFactory);
    assertTrue(sessionFactory instanceof SessionFactory);
}
Also used : ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) SessionFactory(org.hibernate.SessionFactory) ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) Test(org.junit.jupiter.api.Test)

Example 48 with ISessionFactory

use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testBuildSessionFactory.

@Test
public void testBuildSessionFactory() throws Throwable {
    ISessionFactory sessionFactoryFacade = configurationFacade.buildSessionFactory();
    assertNotNull(sessionFactoryFacade);
    Object sessionFactory = ((IFacade) sessionFactoryFacade).getTarget();
    assertNotNull(sessionFactory);
    assertTrue(sessionFactory instanceof SessionFactory);
}
Also used : ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) SessionFactory(org.hibernate.SessionFactory) ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) Test(org.junit.jupiter.api.Test)

Example 49 with ISessionFactory

use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testBuildSessionFactory.

@Test
public void testBuildSessionFactory() throws Throwable {
    ISessionFactory sessionFactoryFacade = configurationFacade.buildSessionFactory();
    assertNotNull(sessionFactoryFacade);
    Object sessionFactory = ((IFacade) sessionFactoryFacade).getTarget();
    assertNotNull(sessionFactory);
    assertTrue(sessionFactory instanceof SessionFactory);
}
Also used : ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) SessionFactory(org.hibernate.SessionFactory) ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) Test(org.junit.jupiter.api.Test) MetadataHelperTest(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MetadataHelperTest)

Aggregations

ISessionFactory (org.jboss.tools.hibernate.runtime.spi.ISessionFactory)49 SessionFactory (org.hibernate.SessionFactory)37 Test (org.junit.jupiter.api.Test)32 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)22 Test (org.junit.Test)15 Configuration (org.hibernate.cfg.Configuration)13 PersistentClass (org.hibernate.mapping.PersistentClass)12 RootClass (org.hibernate.mapping.RootClass)12 IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)12 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)12 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)11 File (java.io.File)10 FileWriter (java.io.FileWriter)10 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)10 IHQLQueryPlan (org.jboss.tools.hibernate.runtime.spi.IHQLQueryPlan)10 HQLQueryPlan (org.hibernate.engine.query.spi.HQLQueryPlan)9 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)5 Ignore (org.junit.Ignore)4 IClassMetadata (org.jboss.tools.hibernate.runtime.spi.IClassMetadata)2 ICollectionMetadata (org.jboss.tools.hibernate.runtime.spi.ICollectionMetadata)2