use of org.jboss.tools.hibernate.runtime.spi.IEntityMetamodel in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateEntityMetamodel.
@Test
public void testCreateEntityMetamodel() {
Configuration configuration = new Configuration();
configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
builder.applySettings(configuration.getProperties());
ServiceRegistry serviceRegistry = builder.build();
SessionFactoryImplementor sfi = (SessionFactoryImplementor) configuration.buildSessionFactory(serviceRegistry);
RootClass rc = new RootClass(null);
MetadataImplementor m = (MetadataImplementor) MetadataHelper.getMetadata(configuration);
SimpleValue sv = new SimpleValue(m);
sv.setNullValue("null");
sv.setTypeName(Integer.class.getName());
rc.setIdentifier(sv);
EntityMetamodel entityMetamodel = new EntityMetamodel(rc, null, sfi);
IEntityMetamodel facade = facadeFactory.createEntityMetamodel(entityMetamodel);
Assert.assertSame(entityMetamodel, ((IFacade) facade).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.IEntityMetamodel in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateEntityMetamodel.
@Test
public void testCreateEntityMetamodel() {
Configuration configuration = new Configuration();
configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
builder.applySettings(configuration.getProperties());
ServiceRegistry serviceRegistry = builder.build();
SessionFactoryImplementor sfi = (SessionFactoryImplementor) configuration.buildSessionFactory(serviceRegistry);
RootClass rc = new RootClass(null);
MetadataImplementor m = (MetadataImplementor) MetadataHelper.getMetadata(configuration);
SimpleValue sv = new SimpleValue(m);
sv.setNullValue("null");
sv.setTypeName(Integer.class.getName());
rc.setIdentifier(sv);
EntityMetamodel entityMetamodel = new EntityMetamodel(rc, null, sfi);
IEntityMetamodel facade = facadeFactory.createEntityMetamodel(entityMetamodel);
Assert.assertSame(entityMetamodel, ((IFacade) facade).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.IEntityMetamodel in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateEntityMetamodel.
@Test
public void testCreateEntityMetamodel() {
MetadataSources metadataSources = new MetadataSources();
StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
ssrb.applySetting("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
MetadataImplementor m = (MetadataImplementor) metadataSources.buildMetadata(ssrb.build());
SessionFactoryImplementor sfi = (SessionFactoryImplementor) m.buildSessionFactory();
RootClass rc = new RootClass(null);
SimpleValue sv = new SimpleValue(m);
sv.setNullValue("null");
sv.setTypeName(Integer.class.getName());
rc.setIdentifier(sv);
EntityMetamodel entityMetamodel = new EntityMetamodel(rc, null, sfi);
IEntityMetamodel facade = facadeFactory.createEntityMetamodel(entityMetamodel);
Assert.assertSame(entityMetamodel, ((IFacade) facade).getTarget());
}
Aggregations