Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
07/02/08 19:40:36 (5 months ago)
Author:
bmckown
Message:

Merging trunk to complex-obs [4379][4764]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs/branches/complex-obs/src/api/org/openmrs/api/db/hibernate/HibernatePatientDAO.java

    r4417 r4785  
    8989                        // and rows in the person and patient table will be created by  
    9090                        // hibernate 
    91                 sessionFactory.getCurrentSession().saveOrUpdate(patient); 
    92                 return patient; 
     91                       sessionFactory.getCurrentSession().saveOrUpdate(patient); 
     92                       return patient; 
    9393                } else { 
    9494                        // if we're updating a patient, its possible that a person 
     
    107107                        } 
    108108                         
     109                        // TODO: look at UserService.saveUser(User) to see how to do it without 
     110                        //              it requiring a merge 
    109111                        // do a merge here because of the previous get 2 lines up 
    110112                        patient = (Patient) sessionFactory.getCurrentSession() 
     
    149151         
    150152        criteria.createAlias("names", "name"); 
    151                 criteria.add(Expression.eq("name.voided", false)); 
    152153                criteria.addOrder(Order.asc("name.givenName")); 
    153154                criteria.addOrder(Order.asc("name.middleName")); 
    154155                criteria.addOrder(Order.asc("name.familyName")); 
    155156         
     157                // get only distinct patients  
     158                criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); 
     159                 
    156160        if (name != null) { 
    157161                // TODO simple name search to start testing, will need to make "real" 
     
    180184                                } 
    181185                                criteria.add(searchExpression); 
    182               } 
    183               } 
    184                  
    185       } 
     186                      } 
     187              } 
     188                 
     189      } 
    186190         
    187191        // do the restriction on either identifier string or types