Example usage for org.hibernate TypeHelper basic

List of usage examples for org.hibernate TypeHelper basic

Introduction

In this page you can find the example usage for org.hibernate TypeHelper basic.

Prototype

public BasicType basic(Class javaType);

Source Link

Document

Convenience form of #basic(String) .

Usage

From source file:to.etc.domui.hibernate.model.CriteriaCreatingVisitor.java

License:Open Source License

@Override
public void visitSqlRestriction(@NonNull QSqlRestriction v) throws Exception {
    if (v.getParameters().length == 0) {
        m_last = Restrictions.sqlRestriction(v.getSql());
        return;//from  w w w  .  ja  v  a2  s .c o  m
    }

    //-- Parameterized SQL query -> convert to Hibernate types.
    Type[] htar = new Type[v.getParameters().length];
    for (int i = 0; i < v.getTypes().length; i++) {
        Class<?> c = v.getTypes()[i];
        if (c == null)
            throw new QQuerySyntaxException("Type array for SQLRestriction cannot contain null");
        org.hibernate.TypeHelper th = m_session.getTypeHelper();

        Type t = th.basic(c.getName());
        if (null == t) {
            throw new QQuerySyntaxException(
                    "Type[" + i + "] in type array (a " + c + ") is not a proper Hibernate type");

        }
        htar[i] = t;
    }
    m_last = Restrictions.sqlRestriction(v.getSql(), v.getParameters(), htar);
}