/** * Trace log that the query is executing. */ private void logExecution(int op, OrderedMap<Object, Class<?>> types, Object[] params) { OrderedMap<Object, Object> pmap = new OrderedMap<Object, Object>(); if (params.length > 0) { if (types != null && types.size() == params.length) { int i = 0; for (Iterator<Object> itr = types.keySet().iterator(); itr.hasNext();) pmap.put(itr.next(), params[i++]); } else { for (int i = 0; i < params.length; i++) pmap.put(String.valueOf(i), params[i]); } } logExecution(op, pmap); }
/** * Trace log that the query is executing. */ private void logExecution(int op, OrderedMap<Object, Class<?>> types, Object[] params) { OrderedMap<Object, Object> pmap = new OrderedMap<Object, Object>(); if (params.length > 0) { if (types != null && types.size() == params.length) { int i = 0; for (Iterator<Object> itr = types.keySet().iterator(); itr.hasNext();) pmap.put(itr.next(), params[i++]); } else { for (int i = 0; i < params.length; i++) pmap.put(String.valueOf(i), params[i]); } } logExecution(op, pmap); }
/** * Trace log that the query is executing. */ private void logExecution(int op, OrderedMap<Object, Class<?>> types, Object[] params) { OrderedMap<Object, Object> pmap = new OrderedMap<Object, Object>(); if (params.length > 0) { if (types != null && types.size() == params.length) { int i = 0; for (Iterator<Object> itr = types.keySet().iterator(); itr.hasNext();) pmap.put(itr.next(), params[i++]); } else { for (int i = 0; i < params.length; i++) pmap.put(String.valueOf(i), params[i]); } } logExecution(op, pmap); }
/** * Trace log that the query is executing. */ private void logExecution(int op, OrderedMap<Object, Class<?>> types, Object[] params) { OrderedMap<Object, Object> pmap = new OrderedMap<Object, Object>(); if (params.length > 0) { if (types != null && types.size() == params.length) { int i = 0; for (Iterator<Object> itr = types.keySet().iterator(); itr.hasNext();) pmap.put(itr.next(), params[i++]); } else { for (int i = 0; i < params.length; i++) pmap.put(String.valueOf(i), params[i]); } } logExecution(op, pmap); }
/** * Registers the given parameter. */ void registerParameter(ParameterExpressionImpl<?> p) { if (_params == null) _params = new OrderedMap/*<ParameterExpression<?>, Class<?>*/(); if (!_params.containsKey(p)) { p.setIndex(_params.size()); _params.put(p, p.getJavaType()); } }
/** * Registers the given parameter. */ void registerParameter(ParameterExpressionImpl<?> p) { if (_params == null) _params = new OrderedMap/*<ParameterExpression<?>, Class<?>*/(); if (!_params.containsKey(p)) { p.setIndex(_params.size()); _params.put(p, p.getJavaType()); } }
/** * Registers the given parameter. */ void registerParameter(ParameterExpressionImpl<?> p) { if (_params == null) _params = new OrderedMap/*<ParameterExpression<?>, Class<?>*/(); if (!_params.containsKey(p)) { p.setIndex(_params.size()); _params.put(p, p.getJavaType()); } }
/** * Registers the given parameter. */ void registerParameter(ParameterExpressionImpl<?> p) { if (_params == null) _params = new OrderedMap/*<ParameterExpression<?>, Class<?>*/(); if (!_params.containsKey(p)) { p.setIndex(_params.size()); _params.put(p, p.getJavaType()); } }
/** * Parse the parameter declarations. */ private OrderedMap<Object, Class<?>> bindParameterTypes() { ctx.lock(); try { if (_params != null) return _params; String params = ctx.getParameterDeclaration(); if (params == null) return EMPTY_ORDERED_PARAMS; List decs = Filters.parseDeclaration(params, ',', "parameters"); if (_params == null) _params = new OrderedMap<Object, Class<?>>(); String name; Class cls; for (int i = 0; i < decs.size(); i += 2) { name = (String) decs.get(i); cls = ctx.classForName(name, null); if (cls == null) throw new UserException(_loc.get("bad-param-type", name)); _params.put(decs.get(i + 1), cls); } return _params; } finally { ctx.unlock(); } }
/** * Parse the parameter declarations. */ private OrderedMap<Object, Class<?>> bindParameterTypes() { ctx.lock(); try { if (_params != null) return _params; String params = ctx.getParameterDeclaration(); if (params == null) return EMPTY_ORDERED_PARAMS; List decs = Filters.parseDeclaration(params, ',', "parameters"); if (_params == null) _params = new OrderedMap<Object, Class<?>>(); String name; Class cls; for (int i = 0; i < decs.size(); i += 2) { name = (String) decs.get(i); cls = ctx.classForName(name, null); if (cls == null) throw new UserException(_loc.get("bad-param-type", name)); _params.put(decs.get(i + 1), cls); } return _params; } finally { ctx.unlock(); } }
/** * Parse the parameter declarations. */ private OrderedMap<Object, Class<?>> bindParameterTypes() { ctx.lock(); try { if (_params != null) return _params; String params = ctx.getParameterDeclaration(); if (params == null) return EMPTY_ORDERED_PARAMS; List decs = Filters.parseDeclaration(params, ',', "parameters"); if (_params == null) _params = new OrderedMap<Object, Class<?>>(); String name; Class cls; for (int i = 0; i < decs.size(); i += 2) { name = (String) decs.get(i); cls = ctx.classForName(name, null); if (cls == null) throw new UserException(_loc.get("bad-param-type", name)); _params.put(decs.get(i + 1), cls); } return _params; } finally { ctx.unlock(); } }
/** * Parse the parameter declarations. */ private OrderedMap<Object, Class<?>> bindParameterTypes() { ctx.lock(); try { if (_params != null) return _params; String params = ctx.getParameterDeclaration(); if (params == null) return EMPTY_ORDERED_PARAMS; List decs = Filters.parseDeclaration(params, ',', "parameters"); if (_params == null) _params = new OrderedMap<Object, Class<?>>(); String name; Class cls; for (int i = 0; i < decs.size(); i += 2) { name = (String) decs.get(i); cls = ctx.classForName(name, null); if (cls == null) throw new UserException(_loc.get("bad-param-type", name)); _params.put(decs.get(i + 1), cls); } return _params; } finally { ctx.unlock(); } }
Object paramKey = positional ? Integer.parseInt(id) : id; if (!parameterTypes.containsKey(paramKey)) parameterTypes.put(paramKey, TYPE_OBJECT);
Object paramKey = positional ? Integer.parseInt(id) : id; if (!parameterTypes.containsKey(paramKey)) parameterTypes.put(paramKey, TYPE_OBJECT);
Object paramKey = positional ? Integer.parseInt(id) : id; if (!parameterTypes.containsKey(paramKey)) parameterTypes.put(paramKey, TYPE_OBJECT);
public static void setImplicitTypes(Value val1, Value val2, Class<?> expected, Resolver resolver, OrderedMap<Object,Class<?>> parameterTypes, String currentQuery) { AbstractExpressionBuilder.setImplicitTypes(val1, val2, expected, resolver); // as well as setting the types for conversions, we also need to // ensure that any parameters are declared with the correct type, // since the JPA spec expects that these will be validated Parameter param = val1 instanceof Parameter ? (Parameter) val1 : val2 instanceof Parameter ? (Parameter) val2 : null; Path path = val1 instanceof Path ? (Path) val1 : val2 instanceof Path ? (Path) val2 : null; // we only check for parameter-to-path comparisons if (param == null || path == null || parameterTypes == null) return; FieldMetaData fmd = path.last(); if (fmd == null) return; if (expected == null) checkEmbeddable(path, currentQuery); Class<?> type = path.getType(); if (type == null) return; Object paramKey = param.getParameterKey(); if (paramKey == null) return; // make sure we have already declared the parameter if (parameterTypes.containsKey(paramKey)) parameterTypes.put(paramKey, type); }
public static void setImplicitTypes(Value val1, Value val2, Class<?> expected, Resolver resolver, OrderedMap<Object,Class<?>> parameterTypes, String currentQuery) { AbstractExpressionBuilder.setImplicitTypes(val1, val2, expected, resolver); // as well as setting the types for conversions, we also need to // ensure that any parameters are declared with the correct type, // since the JPA spec expects that these will be validated Parameter param = val1 instanceof Parameter ? (Parameter) val1 : val2 instanceof Parameter ? (Parameter) val2 : null; Path path = val1 instanceof Path ? (Path) val1 : val2 instanceof Path ? (Path) val2 : null; // we only check for parameter-to-path comparisons if (param == null || path == null || parameterTypes == null) return; FieldMetaData fmd = path.last(); if (fmd == null) return; if (expected == null) checkEmbeddable(path, currentQuery); Class<?> type = path.getType(); if (type == null) return; Object paramKey = param.getParameterKey(); if (paramKey == null) return; // make sure we have already declared the parameter if (parameterTypes.containsKey(paramKey)) parameterTypes.put(paramKey, type); }
public static void setImplicitTypes(Value val1, Value val2, Class<?> expected, Resolver resolver, OrderedMap<Object,Class<?>> parameterTypes, String currentQuery) { AbstractExpressionBuilder.setImplicitTypes(val1, val2, expected, resolver); // as well as setting the types for conversions, we also need to // ensure that any parameters are declared with the correct type, // since the JPA spec expects that these will be validated Parameter param = val1 instanceof Parameter ? (Parameter) val1 : val2 instanceof Parameter ? (Parameter) val2 : null; Path path = val1 instanceof Path ? (Path) val1 : val2 instanceof Path ? (Path) val2 : null; // we only check for parameter-to-path comparisons if (param == null || path == null || parameterTypes == null) return; FieldMetaData fmd = path.last(); if (fmd == null) return; if (expected == null) checkEmbeddable(path, currentQuery); Class<?> type = path.getType(); if (type == null) return; Object paramKey = param.getParameterKey(); if (paramKey == null) return; // make sure we have already declared the parameter if (parameterTypes.containsKey(paramKey)) parameterTypes.put(paramKey, type); }
public static void setImplicitTypes(Value val1, Value val2, Class<?> expected, Resolver resolver, OrderedMap<Object,Class<?>> parameterTypes, String currentQuery) { AbstractExpressionBuilder.setImplicitTypes(val1, val2, expected, resolver); // as well as setting the types for conversions, we also need to // ensure that any parameters are declared with the correct type, // since the JPA spec expects that these will be validated Parameter param = val1 instanceof Parameter ? (Parameter) val1 : val2 instanceof Parameter ? (Parameter) val2 : null; Path path = val1 instanceof Path ? (Path) val1 : val2 instanceof Path ? (Path) val2 : null; // we only check for parameter-to-path comparisons if (param == null || path == null || parameterTypes == null) return; FieldMetaData fmd = path.last(); if (fmd == null) return; if (expected == null) checkEmbeddable(path, currentQuery); Class<?> type = path.getType(); if (type == null) return; Object paramKey = param.getParameterKey(); if (paramKey == null) return; // make sure we have already declared the parameter if (parameterTypes.containsKey(paramKey)) parameterTypes.put(paramKey, type); }