Package javax.persistence.criteria

Examples of javax.persistence.criteria.Path



    @Override
    public Predicate buildPredicate(From root, CriteriaBuilder cb, Comparison operator, String argument)
    {
        Path from = getFrom(root,PathIterator.getPath(propertyPath));

        Object parsed =  argumentParser.parse(argument,from.get(propertyName).getJavaType());
        return createPredicate(from,cb,propertyName,operator,parsed);
    }
View Full Code Here


  }

  @Override
  @SuppressWarnings("unchecked")
  public CriteriaUpdate<T> set(String attributeName, Object value) {
    final Path attributePath = getRoot().get( attributeName );
    final Expression valueExpression = value == null
        ? criteriaBuilder().nullLiteral( attributePath.getJavaType() )
        : criteriaBuilder().literal( value );
    addAssignment( attributePath, valueExpression );
    return this;
  }
View Full Code Here

  @Test
  public void shouldSetParameters() {
    Filter filter = new Filter();
    filter.addCondition("testKey", Operator.eq, "testValue");
    filter.addCondition("testKey1", Operator.eq, "testValue1");
    Path path = mock(Path.class);
    when(path.getJavaType()).thenReturn(String.class);
    filter.getConditions().get(0).setPath(path);
    filter.getConditions().get(1).setPath(path);
    Query query = mock(Query.class);
    Parameter param = mock(Parameter.class);
    when(param.getParameterType()).thenReturn(String.class);
View Full Code Here

      for (Iterator it = query.getCriterions(); it.hasNext();)
      {
        PersistenceCriterion criterion = (PersistenceCriterion) it.next();

        String property = criterion.getProperty();
        Path propertyExpression = determinePropertyPath(property, entity);
        String operator = criterion.getOperator();
        Object value = criterion.getOperand();

        if (value != null && isPersistentObject(value))
        {
View Full Code Here

    }
  }

  private Path determinePropertyPath(final String property, final Root entity)
  {
    Path x = null;
    StringTokenizer st = new StringTokenizer(property);
    while (st.hasMoreTokens())
    {
      String p = st.nextToken();
      if (x == null)
        x = entity.get(p);
      else
        x = x.get(p);
    }
    return x;
  }
View Full Code Here

TOP

Related Classes of javax.persistence.criteria.Path

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.