예제 #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
  @SuppressWarnings({"unchecked"})
  public String render(CriteriaQueryCompiler.RenderingContext renderingContext) {
    if (ValueHandlerFactory.isNumeric(literal)) {
      return ValueHandlerFactory.determineAppropriateHandler((Class) literal.getClass())
          .render(literal);
    }

    // else...
    final String parameterName =
        renderingContext.registerLiteralParameterBinding(getLiteral(), getJavaType());
    return ':' + parameterName;
  }
예제 #3
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);
    }
  }