Changeset 1366


Ignore:
Timestamp:
May 23, 2011, 2:23:45 PM (12 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #324: Problem registering a case for specimen tubes with children

Location:
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Case.java

    r1341 r1366  
    6969      caseQuery.join(Hql.innerJoin("src", "event", "evt"));
    7070      caseQuery.join(Hql.innerJoin("evt", "bioMaterial", "bm")); // 'bm' should now refernce a specimen tube
    71       caseQuery.restrict(Restrictions.like(Hql.property("bm", "name"), Expressions.parameter("name", name + ".%", Type.STRING)));
     71      caseQuery.restrict(Restrictions.rlike(Hql.property("bm", "name"), Expressions.parameter("name", "^" + name + "\\.[0-9]+$", Type.STRING)));
    7272      caseQuery.setDistinct(true);
     73     
     74      System.out.println("cq:" + caseQuery);
    7375      cases = caseQuery.list(dc);
    7476     
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/SpecimenTube.java

    r1326 r1366  
    3434    if (limitToOriginal)
    3535    {
    36       specimenQuery.restrict(Restrictions.like(Hql.property("name"), Expressions.parameter("name", theCase.getOriginalName() + ".%", Type.STRING)));
     36      specimenQuery.restrict(Restrictions.rlike(Hql.property("name"), Expressions.parameter("name", "^" + theCase.getOriginalName() + "\\.[0-9]+$", Type.STRING)));
    3737    }
    3838    specimenQuery.order(Orders.asc(Hql.property("name")));
     
    5656  {
    5757    ItemQuery<Sample> specimenQuery = Sample.getQuery();
    58     specimenQuery.restrict(Restrictions.like(Hql.property("name"), Expressions.parameter("name", name + ".%", Type.STRING)));
     58    specimenQuery.restrict(Restrictions.rlike(Hql.property("name"), Expressions.parameter("name", "^" + name + "\\.[0-9]+$", Type.STRING)));
    5959    specimenQuery.order(Orders.asc(Hql.property("name")));
    6060    specimenQuery.include(Include.ALL);
Note: See TracChangeset for help on using the changeset viewer.