Changeset 4785 for openmrs/branches/complex-obs/src/api/org/openmrs/api/db/hibernate/HibernatePatientDAO.java
- Timestamp:
- 07/02/08 19:40:36 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs/branches/complex-obs/src/api/org/openmrs/api/db/hibernate/HibernatePatientDAO.java
r4417 r4785 89 89 // and rows in the person and patient table will be created by 90 90 // hibernate 91 sessionFactory.getCurrentSession().saveOrUpdate(patient);92 return patient;91 sessionFactory.getCurrentSession().saveOrUpdate(patient); 92 return patient; 93 93 } else { 94 94 // if we're updating a patient, its possible that a person … … 107 107 } 108 108 109 // TODO: look at UserService.saveUser(User) to see how to do it without 110 // it requiring a merge 109 111 // do a merge here because of the previous get 2 lines up 110 112 patient = (Patient) sessionFactory.getCurrentSession() … … 149 151 150 152 criteria.createAlias("names", "name"); 151 criteria.add(Expression.eq("name.voided", false));152 153 criteria.addOrder(Order.asc("name.givenName")); 153 154 criteria.addOrder(Order.asc("name.middleName")); 154 155 criteria.addOrder(Order.asc("name.familyName")); 155 156 157 // get only distinct patients 158 criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); 159 156 160 if (name != null) { 157 161 // TODO simple name search to start testing, will need to make "real" … … 180 184 } 181 185 criteria.add(searchExpression); 182 }183 }184 185 }186 } 187 } 188 189 } 186 190 187 191 // do the restriction on either identifier string or types