Package org.dayatang.domain

Examples of org.dayatang.domain.NamedParameters


    return getRepository().get(Observer.class, id);
  }

  public static List<Observer> findBySubject(Subject subject) {
    String queryString = "select o from Observer o where :subjectKey in elements(o.subjectKeys))";
                NamedParameters params = NamedParameters.create().add("subjectKey", subject.getSubjectKey());
    List<Object> observers = getRepository().createJpqlQuery(queryString)
                .addParameter("subjectKey", subject.getSubjectKey()).list();

    if (logger.isDebugEnabled()) {
      if (observers.isEmpty()) {
View Full Code Here


            //return getPropNameWithAlias() + " in (" + createInString(value) + ")";
    }

    @Override
    public NamedParameters getParameters() {
        NamedParameters result = NamedParameters.create();
        if (!value.isEmpty()) {
            result = result.add(getParamName(), value);
        }
        return result;
    }
View Full Code Here

    return "(" + StringUtils.join(subCriterionsStr, " or ") + ")";
  }

  @Override
  public NamedParameters getParameters() {
    NamedParameters result = NamedParameters.create();
        for (QueryCriterion each : getCriterons()) {
          result.add(each.getParameters());
        }
    return result;
  }
View Full Code Here

        assertEquals(params, instance.getParams());
    }

    @Test
    public void testAddAnother() {
        NamedParameters other = NamedParameters.create().add("age", 15);
        instance = NamedParameters.create().add("id", 12).add("name", "abc")
                .add(other);
        params.put("age", 15);
        assertEquals(params, instance.getParams());
    }
View Full Code Here

    @Test
    public void testEquals() {
        instance = NamedParameters.create(params);
        assertTrue(instance.equals(instance));
        assertFalse(instance.equals(params));
        NamedParameters other = NamedParameters.create(params);
        assertTrue(instance.equals(other));
        assertTrue(other.equals(instance));
       
        other = NamedParameters.create().add("name", "abc");
        assertFalse(instance.equals(other));
        assertFalse(other.equals(instance));
    }
View Full Code Here

    return StringUtils.join(subCriterionsStr, " and ");
  }

  @Override
  public NamedParameters getParameters() {
    NamedParameters result = NamedParameters.create();
        for (QueryCriterion each : getCriterons()) {
          result.add(each.getParameters());
        }
    return result;
  }
View Full Code Here

        return getPropNameWithAlias() + " in " + getParamNameWithColon();
    }

    @Override
    public NamedParameters getParameters() {
        NamedParameters result = NamedParameters.create();
        if (!value.isEmpty()) {
            result = result.add(getParamName(), value);
        }
        return result;
    }
View Full Code Here

    /**
     * Test of getByBusinessKeys method
     */
    @Test
    public void testGetByBusinessKeys() {
        NamedParameters params = NamedParameters.create()
                .add("category", education)
                .add("code", "02");
        Dictionary result = repository.getByBusinessKeys(Dictionary.class, params);
        assertEquals(graduate, result);
    }
View Full Code Here

    /**
     * Test of findByProperties method
     */
    @Test
    public void testFindByProperties() {
        NamedParameters params = NamedParameters.create()
                .add("category", education)
                .add("code", "02");
        List<Dictionary> results = repository.findByProperties(Dictionary.class, params);
        assertTrue(results.contains(graduate));
        assertFalse(results.contains(undergraduate));
View Full Code Here

    /**
     * Test of getByBusinessKeys method
     */
    @Test
    public void testGetByBusinessKeys() {
        NamedParameters params = NamedParameters.create()
                .add("category", education)
                .add("code", "02");
        Dictionary result = repository.getByBusinessKeys(Dictionary.class, params);
        assertEquals(graduate, result);
    }
View Full Code Here

TOP

Related Classes of org.dayatang.domain.NamedParameters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.