Package javax.persistence.criteria

Examples of javax.persistence.criteria.Expression


  }

  @Override
  @SuppressWarnings("unchecked")
  public <Y, X extends Y> CriteriaUpdate<T> set(Path<Y> attributePath, X value) {
    final Expression valueExpression = value == null
        ? criteriaBuilder().nullLiteral( attributePath.getJavaType() )
        : criteriaBuilder().literal( value );
    addAssignment( attributePath, valueExpression );
    return this;
  }
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

  }

  @Override
  public String render(boolean isNegated, RenderingContext renderingContext) {
    final StringBuilder buffer = new StringBuilder();
    final Expression exp = getExpression();
    if ( ParameterExpressionImpl.class.isInstance( exp ) ) {
      // technically we only need to CAST (afaik) if expression and all values are parameters.
      // but checking for that condition could take long time on a lon value list
      final ParameterExpressionImpl parameterExpression = (ParameterExpressionImpl) exp;
      final SessionFactoryImplementor sfi = criteriaBuilder().getEntityManagerFactory().unwrap( SessionFactoryImplementor.class );
View Full Code Here

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

  }

  @Override
  @SuppressWarnings("unchecked")
  public <Y, X extends Y> CriteriaUpdate<T> set(Path<Y> attributePath, X value) {
    final Expression valueExpression = value == null
        ? criteriaBuilder().nullLiteral( attributePath.getJavaType() )
        : criteriaBuilder().literal( value );
    addAssignment( attributePath, valueExpression );
    return this;
  }
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

              // converting to the column(s) associated with the entity's ID in the rendered SQL.  However, some DBs don't support
              // the multiple columns that would end up here for entities with composite IDs.  So, since we modify the query to
              // instead specify star since that's functionally equivalent and supported by all DBs.
          List<Expression<?>> argExprs = getArgumentExpressions();
          if (argExprs.size() == 1) {
                  Expression argExpr = argExprs.get(0);
                  if (argExpr instanceof Root<?>) {
                      Root<?> root = (Root<?>)argExpr;
                      if (!root.getModel().hasSingleIdAttribute()) {
                          buffer.append('*');
                          return;
View Full Code Here

     * @param y
     *            expression
     * @return modulus
     */
    public Expression<Integer> mod(Integer x, Expression<Integer> y){
        Expression xExp = internalLiteral(x);
        return new FunctionExpressionImpl(this.metamodel, ClassConstants.INTEGER, ExpressionMath.mod(((InternalSelection)xExp).getCurrentNode(),((InternalSelection)y).getCurrentNode()), buildList(xExp,y), "mod");
    }
View Full Code Here

     */
    public <T> Expression<T> function(String name, Class<T> type, Expression<?>... args){
        if (args != null && args.length > 0){
        List<org.eclipse.persistence.expressions.Expression> params = new ArrayList<org.eclipse.persistence.expressions.Expression>();
        for (int index = 1; index < args.length; ++index){
            Expression x = args[index];
            params.add(((InternalSelection)x).getCurrentNode());
        }
       
        return new FunctionExpressionImpl<T>(metamodel, type, ((InternalSelection)args[0]).getCurrentNode().getFunctionWithArguments(name, params), buildList(args), name);
        }else{
View Full Code Here

     * @param y
     *            expression
     * @return modulus
     */
    public Expression<Integer> mod(Integer x, Expression<Integer> y){
        Expression xExp = literal(x);
        return new FunctionExpressionImpl(this.metamodel, ClassConstants.INTEGER, ExpressionMath.mod(((InternalSelection)xExp).getCurrentNode(),((InternalSelection)y).getCurrentNode()), buildList(xExp,y), "mod");
    }
View Full Code Here

TOP

Related Classes of javax.persistence.criteria.Expression

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.