Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openmrs/openmrs-core
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dc9a8d7746cb
Choose a base ref
...
head repository: openmrs/openmrs-core
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5d66058c7873
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Nov 9, 2013

  1. TRUNK-4055 Substitute deprecated Hibernate.* fields

    Dedunu Dhananjaya committed Nov 9, 2013
    Copy the full SHA
    d308f32 View commit details
  2. Merge pull request #443 from dedunumax/TRUNK-4055

    TRUNK-4055 Substitute deprecated Hibernate.* fields
    dkayiwa committed Nov 9, 2013
    Copy the full SHA
    5d66058 View commit details
Original file line number Diff line number Diff line change
@@ -21,12 +21,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.FlushMode;
import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.stat.QueryStatistics;
import org.hibernate.stat.Statistics;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ConfigHelper;
import org.openmrs.GlobalProperty;
import org.openmrs.User;
@@ -135,10 +135,11 @@ public User authenticate(String login, String password) throws ContextAuthentica
}

String passwordOnRecord = (String) session.createSQLQuery("select password from users where user_id = ?")
.addScalar("password", Hibernate.STRING).setInteger(0, candidateUser.getUserId()).uniqueResult();
.addScalar("password", StandardBasicTypes.STRING).setInteger(0, candidateUser.getUserId())
.uniqueResult();

String saltOnRecord = (String) session.createSQLQuery("select salt from users where user_id = ?").addScalar(
"salt", Hibernate.STRING).setInteger(0, candidateUser.getUserId()).uniqueResult();
"salt", StandardBasicTypes.STRING).setInteger(0, candidateUser.getUserId()).uniqueResult();

// if the username and password match, hydrate the user and return it
if (passwordOnRecord != null && Security.hashMatches(passwordOnRecord, password + saltOnRecord)) {
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
import java.util.regex.Pattern;

import org.hibernate.Criteria;
import org.hibernate.Hibernate;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Conjunction;
import org.hibernate.criterion.Criterion;
@@ -27,6 +26,7 @@
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.hibernate.criterion.SimpleExpression;
import org.hibernate.type.StandardBasicTypes;
import org.openmrs.PatientIdentifierType;
import org.openmrs.api.AdministrationService;
import org.openmrs.api.context.Context;
@@ -162,7 +162,7 @@ else if (regex.equals("") || HibernateUtil.isHSQLDialect(sessionFactory)) {
// if the regex is present, search on that
else {
regex = replaceSearchString(regex, identifier);
conjuction.add(Restrictions.sqlRestriction("identifier regexp ?", regex, Hibernate.STRING));
conjuction.add(Restrictions.sqlRestriction("identifier regexp ?", regex, StandardBasicTypes.STRING));
}
}
}
Original file line number Diff line number Diff line change
@@ -19,13 +19,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Criteria;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.hibernate.type.StandardBasicTypes;
import org.openmrs.api.context.Context;
import org.openmrs.api.db.DAOException;
import org.openmrs.hl7.HL7Constants;
@@ -132,7 +132,7 @@ public HL7InQueue getHL7InQueueByUuid(String uuid) throws DAOException {
public List<HL7InQueue> getAllHL7InQueues() throws DAOException {
return sessionFactory.getCurrentSession()
.createQuery("from HL7InQueue where messageState = ? order by HL7InQueueId").setParameter(0,
HL7Constants.HL7_STATUS_PENDING, Hibernate.INTEGER).list();
HL7Constants.HL7_STATUS_PENDING, StandardBasicTypes.INTEGER).list();
}

/**
@@ -194,7 +194,7 @@ public Long countHL7s(Class clazz, Integer messageState, String query) {
public HL7InQueue getNextHL7InQueue() throws DAOException {
Query query = sessionFactory.getCurrentSession().createQuery(
"from HL7InQueue as hiq where hiq.messageState = ? order by HL7InQueueId").setParameter(0,
HL7Constants.HL7_STATUS_PENDING, Hibernate.INTEGER).setMaxResults(1);
HL7Constants.HL7_STATUS_PENDING, StandardBasicTypes.INTEGER).setMaxResults(1);
if (query == null)
return null;
return (HL7InQueue) query.uniqueResult();
@@ -235,7 +235,7 @@ public List<HL7InArchive> getHL7InArchiveByState(Integer state) throws DAOExcept
@SuppressWarnings("unchecked")
private List<HL7InArchive> getHL7InArchiveByState(Integer state, Integer maxResults) throws DAOException {
Query q = sessionFactory.getCurrentSession().createQuery("from HL7InArchive where messageState = ?").setParameter(0,
state, Hibernate.INTEGER);
state, StandardBasicTypes.INTEGER);
if (maxResults != null)
q.setMaxResults(maxResults);
return q.list();
@@ -247,7 +247,7 @@ private List<HL7InArchive> getHL7InArchiveByState(Integer state, Integer maxResu
@SuppressWarnings("unchecked")
public List<HL7InQueue> getHL7InQueueByState(Integer state) throws DAOException {
return sessionFactory.getCurrentSession().createQuery("from HL7InQueue where messageState = ?").setParameter(0,
state, Hibernate.INTEGER).list();
state, StandardBasicTypes.INTEGER).list();
}

/**
@@ -323,7 +323,7 @@ public void garbageCollect() {
*/
public HL7InArchive getHL7InArchiveByUuid(String uuid) throws DAOException {
Query query = sessionFactory.getCurrentSession().createQuery("from HL7InArchive where uuid = ?").setParameter(0,
uuid, Hibernate.STRING);
uuid, StandardBasicTypes.STRING);
Object record = query.uniqueResult();
if (record == null)
return null;