Example usage for org.hibernate.type StringType INSTANCE

List of usage examples for org.hibernate.type StringType INSTANCE

Introduction

In this page you can find the example usage for org.hibernate.type StringType INSTANCE.

Prototype

StringType INSTANCE

To view the source code for org.hibernate.type StringType INSTANCE.

Click Source Link

Usage

From source file:org.zanata.model.type.ProjectRoleType.java

License:Open Source License

public ProjectRoleType() {
    super(StringType.INSTANCE.getSqlTypeDescriptor(), ProjectRoleDescriptor.INSTANCE);
}

From source file:org.zanata.model.type.RequestStateType.java

License:Open Source License

public RequestStateType() {
    super(StringType.INSTANCE.getSqlTypeDescriptor(), RequestStateTypeDescriptor.INSTANCE);
}

From source file:org.zanata.model.type.RequestTypeType.java

License:Open Source License

public RequestTypeType() {
    super(StringType.INSTANCE.getSqlTypeDescriptor(), RequestTypeTypeDescriptor.INSTANCE);
}

From source file:org.zanata.model.type.RoleTypeType.java

License:Open Source License

public RoleTypeType() {
    super(StringType.INSTANCE.getSqlTypeDescriptor(), RoleTypeDescriptor.INSTANCE);
}

From source file:org.zanata.model.type.TranslationSourceTypeType.java

License:Open Source License

public TranslationSourceTypeType() {
    super(StringType.INSTANCE.getSqlTypeDescriptor(), TranslationSourceTypeTypeDescriptor.INSTANCE);
}

From source file:org.zanata.model.type.WebhookTypeType.java

License:Open Source License

public WebhookTypeType() {
    super(StringType.INSTANCE.getSqlTypeDescriptor(), WebhookTypeTypeDescriptor.INSTANCE);
}

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

License:Open Source License

private void handleLikeOperation(String name, PropertyMetaModel<?> pmm, Object value) throws Exception {
    //-- Check if there is a type mismatch in parameter type...
    if (!(value instanceof String))
        throw new QQuerySyntaxException(
                "The argument to 'like' must be a string (and cannot be null), the value passed is: " + value);

    if (pmm == null || pmm.getActualType() == String.class) {
        m_last = Restrictions.like(name, value);
        return;/*from   w ww. j ava2  s . c  o m*/
    }

    ClassMetadata hibmd = m_session.getSessionFactory().getClassMetadata(pmm.getClassModel().getActualClass());
    if (null == hibmd)
        throw new QQuerySyntaxException("Cannot obtain Hibernate metadata for property=" + pmm);

    if (!(hibmd instanceof AbstractEntityPersister))
        throw new QQuerySyntaxException("Cannot obtain Hibernate metadata for property=" + pmm
                + ": expecting AbstractEntityPersister, got a " + hibmd.getClass());
    AbstractEntityPersister aep = (AbstractEntityPersister) hibmd;
    String[] colar = getPropertyColumnNamesFromLousyMetadata(aep, name);
    if (colar.length != 1)
        throw new IllegalStateException("Attempt to do a 'like' on a multi-column property: " + pmm);
    String columnName = colar[0];
    int dotix = name.lastIndexOf('.');
    if (dotix == -1) {
        //-- We need Hibernate metadata to find the column name....
        m_last = Restrictions.sqlRestriction("{alias}." + columnName + " like ?", value, StringType.INSTANCE);
        return;
    }

    String sql = "{" + name + "} like ?";
    m_last = new HibernateAliasedSqlCriterion(sql, value, StringType.INSTANCE);
}