Changeset 4947 for openmrs/branches/1.3.x/src/api/org/openmrs/api/db/hibernate/HibernatePersonDAO.java
- Timestamp:
- 07/16/08 12:29:31 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs/branches/1.3.x/src/api/org/openmrs/api/db/hibernate/HibernatePersonDAO.java
r4358 r4947 26 26 import org.hibernate.criterion.MatchMode; 27 27 import org.hibernate.criterion.Order; 28 import org.hibernate.criterion.Restrictions; 28 29 import org.hibernate.type.StringType; 29 30 import org.openmrs.Person; … … 376 377 public List<RelationshipType> getRelationshipTypes(String relationshipTypeName, Boolean preferred) throws DAOException { 377 378 378 Criteria criteria = sessionFactory.getCurrentSession().createCriteria(RelationshipType.class, "t"); 379 criteria.add(Expression.eq("retired", false)); 380 criteria.add(Expression.sql("CONCAT(t.aIsToB, CONCAT('/', t.bIsToA))", relationshipTypeName, new StringType())); 379 Criteria criteria = sessionFactory.getCurrentSession().createCriteria(RelationshipType.class); 380 criteria.add(Restrictions.sqlRestriction("CONCAT(a_Is_To_B, CONCAT('/', b_Is_To_A)) like (?)", relationshipTypeName, new StringType())); 381 381 382 382 if (preferred != null) … … 388 388 /** 389 389 * @see org.openmrs.api.PatientService#getRelationshipTypes() 390 * @see org.openmrs.api.db.PersonDAO#getAllRelationshipTypes( boolean)390 * @see org.openmrs.api.db.PersonDAO#getAllRelationshipTypes() 391 391 */ 392 392 @SuppressWarnings("unchecked") 393 public List<RelationshipType> getAllRelationshipTypes( boolean includeRetired) throws DAOException {393 public List<RelationshipType> getAllRelationshipTypes() throws DAOException { 394 394 395 395 Criteria criteria = sessionFactory.getCurrentSession().createCriteria(RelationshipType.class, "t"); 396 396 397 if (!includeRetired)398 criteria.add(Expression.eq("retired", false)); 397 /**if (!includeRetired) 398 criteria.add(Expression.eq("retired", false));*/ 399 399 400 400 criteria.addOrder(Order.asc("weight"));