use of org.hibernate.impl.SessionFactoryImpl in project head by mifos.
the class BirtReportValidationAction method addDatabaseInformationsToRequestAttributes.
private void addDatabaseInformationsToRequestAttributes(HttpServletRequest request) {
SessionFactoryImpl sessionFactoryImpl = (SessionFactoryImpl) StaticHibernateUtil.getSessionFactory();
Properties properties = sessionFactoryImpl.getProperties();
request.setAttribute("odaURL", properties.get("hibernate.connection.url"));
request.setAttribute("odaUser", properties.get("hibernate.connection.username"));
request.setAttribute("odaPassword", properties.get("hibernate.connection.password"));
}
use of org.hibernate.impl.SessionFactoryImpl in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newHQLQueryPlan.
@Override
public IHQLQueryPlan newHQLQueryPlan(String query, boolean shallow, ISessionFactory sessionFactory) {
assert sessionFactory instanceof IFacade;
SessionFactoryImpl factory = (SessionFactoryImpl) ((IFacade) sessionFactory).getTarget();
Map<String, Filter> enabledFilters = Collections.emptyMap();
HQLQueryPlan queryPlan = new HQLQueryPlan(query, shallow, enabledFilters, factory);
return facadeFactory.createHQLQueryPlan(queryPlan);
}
use of org.hibernate.impl.SessionFactoryImpl in project jbosstools-hibernate by jbosstools.
the class EntityMetamodelFacadeTest method setUp.
@SuppressWarnings("serial")
@Before
public void setUp() throws Exception {
Configuration configuration = new Configuration();
configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
SessionFactoryImplementor sfi = new SessionFactoryImpl(configuration, null, configuration.buildSettings(), null, null);
RootClass rc = new RootClass();
Table t = new Table("foobar");
rc.setTable(t);
Column c = new Column("foo");
t.addColumn(c);
ArrayList<Column> keyList = new ArrayList<>();
keyList.add(c);
t.createUniqueKey(keyList);
SimpleValue sv = new SimpleValue();
sv.setNullValue("null");
sv.setTypeName(Integer.class.getName());
sv.addColumn(c);
rc.setEntityName("foobar");
rc.setIdentifier(sv);
entityMetamodel = new EntityMetamodel(rc, sfi) {
@Override
public EntityTuplizer getTuplizer(EntityMode entityMode) {
return (EntityTuplizer) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { EntityTuplizer.class }, new TestInvocationHandler());
}
@Override
public Integer getPropertyIndexOrNull(String id) {
methodName = "getPropertyIndexOrNull";
arguments = new Object[] { id };
return INDEX;
}
};
entityMetamodelFacade = new EntityMetamodelFacadeImpl(FACADE_FACTORY, entityMetamodel);
}
use of org.hibernate.impl.SessionFactoryImpl in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateHQLQueryPlan.
@Test
public void testCreateHQLQueryPlan() {
Configuration configuration = new Configuration();
configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
Mappings mappings = configuration.createMappings();
Table t = new Table("FOO");
Column c = new Column("foo");
t.addColumn(c);
PrimaryKey key = new PrimaryKey();
key.addColumn(c);
t.setPrimaryKey(key);
Mappings m = configuration.createMappings();
SimpleValue sv = new SimpleValue(m);
sv.setNullValue("null");
sv.setTypeName(Integer.class.getName());
sv.setTable(t);
sv.addColumn(c);
RootClass rc = new RootClass();
rc.setEntityName("foo");
rc.setIdentifier(sv);
rc.setTable(t);
mappings.addClass(rc);
SessionFactoryImplementor sfi = new SessionFactoryImpl(configuration, null, configuration.buildSettings(), null, null);
HQLQueryPlan hqlQueryPlan = new HQLQueryPlan("from foo", false, Collections.emptyMap(), sfi);
IHQLQueryPlan facade = facadeFactory.createHQLQueryPlan(hqlQueryPlan);
Assert.assertSame(hqlQueryPlan, ((IFacade) facade).getTarget());
}
use of org.hibernate.impl.SessionFactoryImpl in project jbosstools-hibernate by jbosstools.
the class ClassMetadataFacadeTest method createSampleEntityPersister.
private TestEntityPersister createSampleEntityPersister() {
Configuration configuration = new Configuration();
configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
SessionFactoryImplementor sfi = new SessionFactoryImpl(configuration, null, configuration.buildSettings(), null, null);
RootClass rc = new RootClass();
Table t = new Table("foobar");
rc.setTable(t);
Column c = new Column("foo");
t.addColumn(c);
ArrayList<Column> keyList = new ArrayList<>();
keyList.add(c);
t.createUniqueKey(keyList);
SimpleValue sv = new SimpleValue();
sv.setNullValue("null");
sv.setTypeName(Integer.class.getName());
sv.addColumn(c);
rc.setEntityName("foobar");
rc.setIdentifier(sv);
return new TestEntityPersister(rc, sfi);
}
Aggregations