Search in sources :

Example 1 with DbmsFeatures

use of com.haulmont.cuba.core.sys.persistence.DbmsFeatures in project cuba by cuba-platform.

the class QueryImpl method setParameter.

@Override
public TypedQuery<T> setParameter(int position, Object value, boolean implicitConversions) {
    checkState();
    DbmsFeatures dbmsFeatures = DbmsSpecificFactory.getDbmsFeatures();
    if (isNative && (value instanceof UUID) && (dbmsFeatures.getUuidTypeClassName() != null)) {
        Class c = ReflectionHelper.getClass(dbmsFeatures.getUuidTypeClassName());
        try {
            value = ReflectionHelper.newInstance(c, value);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException("Error setting parameter value", e);
        }
    } else if (value instanceof IdProxy) {
        value = ((IdProxy) value).get();
    } else if (implicitConversions) {
        value = handleImplicitConversions(value);
    }
    params.add(new Param(position, value));
    return this;
}
Also used : DbmsFeatures(com.haulmont.cuba.core.sys.persistence.DbmsFeatures) MetaClass(com.haulmont.chile.core.model.MetaClass) EnumClass(com.haulmont.chile.core.datatypes.impl.EnumClass) IdProxy(com.haulmont.cuba.core.entity.IdProxy)

Aggregations

EnumClass (com.haulmont.chile.core.datatypes.impl.EnumClass)1 MetaClass (com.haulmont.chile.core.model.MetaClass)1 IdProxy (com.haulmont.cuba.core.entity.IdProxy)1 DbmsFeatures (com.haulmont.cuba.core.sys.persistence.DbmsFeatures)1