Пример #1
0
 @SuppressWarnings({"unchecked"})
 public String renderProjection(CriteriaQueryCompiler.RenderingContext renderingContext) {
   // some drivers/servers do not like parameters in the select clause
   final ValueHandlerFactory.ValueHandler handler =
       ValueHandlerFactory.determineAppropriateHandler(literal.getClass());
   if (ValueHandlerFactory.isCharacter(literal)) {
     return '\'' + handler.render(literal) + '\'';
   } else {
     return handler.render(literal);
   }
 }
Пример #2
0
  @Override
  @SuppressWarnings({"unchecked"})
  protected void resetJavaType(Class targetType) {
    super.resetJavaType(targetType);
    ValueHandlerFactory.ValueHandler valueHandler = getValueHandler();
    if (valueHandler == null) {
      valueHandler = ValueHandlerFactory.determineAppropriateHandler(targetType);
      forceConversion(valueHandler);
    }

    if (valueHandler != null) {
      literal = valueHandler.convert(literal);
    }
  }
    @Override
    public Object transformTuple(Object[] tuple, String[] aliases) {
      final Object[] valueHandlerResult;
      if (valueHandlers == null) {
        valueHandlerResult = tuple;
      } else {
        valueHandlerResult = new Object[tuple.length];
        for (int i = 0; i < tuple.length; i++) {
          ValueHandlerFactory.ValueHandler valueHandler = valueHandlers.get(i);
          valueHandlerResult[i] = valueHandler == null ? tuple[i] : valueHandler.convert(tuple[i]);
        }
      }

      return tupleElements == null
          ? valueHandlerResult.length == 1 ? valueHandlerResult[0] : valueHandlerResult
          : new TupleImpl(tuple);
    }