use of org.hibernate.Session in project head by mifos.
the class GenericDaoHibernate method executeUniqueResultNamedQueryWithResultTransformer.
@Override
public final Object executeUniqueResultNamedQueryWithResultTransformer(final String queryName, final Map<String, ?> nameQueryParameters, final Class<?> className) {
try {
Session session = getSession();
Query query = session.getNamedQuery(queryName).setResultTransformer(Transformers.aliasToBean(className));
query.setProperties(nameQueryParameters);
return query.uniqueResult();
} catch (Exception e) {
throw new MifosRuntimeException(e);
}
}
use of org.hibernate.Session in project head by mifos.
the class GenericDaoHibernate method executeNamedQuery.
@SuppressWarnings("unchecked")
@Override
public final List<? extends Object> executeNamedQuery(final String queryName, final Map<String, ?> queryParameters) {
try {
Session session = getSession();
Query query = session.getNamedQuery(queryName);
query.setProperties(queryParameters);
return query.list();
} catch (Exception e) {
throw new MifosRuntimeException(e);
}
}
use of org.hibernate.Session in project head by mifos.
the class GenericDaoHibernate method executeUniqueResultNamedQuery.
@Override
public final Object executeUniqueResultNamedQuery(final String queryName, final Map<String, ?> queryParameters) {
try {
Session session = getSession();
Query query = session.getNamedQuery(queryName);
query.setProperties(queryParameters);
return query.uniqueResult();
} catch (Exception e) {
throw new MifosRuntimeException(e);
}
}
use of org.hibernate.Session in project head by mifos.
the class GenericDaoHibernate method executeNamedQueryIterator.
@SuppressWarnings("unchecked")
@Override
public final Iterator<? extends Object> executeNamedQueryIterator(final String queryName, final Map<String, ?> queryParameters) {
try {
Session session = getSession();
Query query = session.getNamedQuery(queryName);
query.setProperties(queryParameters);
return query.iterate();
} catch (Exception e) {
throw new MifosRuntimeException(e);
}
}
use of org.hibernate.Session in project head by mifos.
the class GenericDaoHibernate method executeNamedQueryDelete.
@SuppressWarnings("unchecked")
@Override
public final int executeNamedQueryDelete(final String queryName, final Map<String, ?> queryParameters) {
try {
Session session = getSession();
Query query = session.getNamedQuery(queryName);
query.setProperties(queryParameters);
return query.executeUpdate();
} catch (Exception e) {
throw new MifosRuntimeException(e);
}
}
Aggregations