org.hibernate.engine.spi.TypedValue#org.hibernate.criterion.CriteriaQuery源码实例Demo

下面列出了org.hibernate.engine.spi.TypedValue#org.hibernate.criterion.CriteriaQuery 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Knowage-Server   文件: InExpressionIgnoringCase.java
@Override
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
	List<TypedValue> list = new ArrayList<>();
	Type type = criteriaQuery.getTypeUsingProjection(criteria, propertyName);
	if (type.isComponentType()) {
		CompositeType actype = (CompositeType) type;
		Type[] types = actype.getSubtypes();
		for (int j = 0; j < values.length; j++) {
			for (int i = 0; i < types.length; i++) {
				Object subval = values[j] == null ? null : actype.getPropertyValues(values[j], EntityMode.POJO)[i];
				list.add(new TypedValue(types[i], subval, EntityMode.POJO));
			}
		}
	} else {
		for (int j = 0; j < values.length; j++) {
			list.add(new TypedValue(type, values[j], EntityMode.POJO));
		}
	}
	return list.toArray(new TypedValue[list.size()]);
}
 
源代码2 项目: gorm-hibernate5   文件: RlikeExpression.java
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
    Dialect dialect = criteriaQuery.getFactory().getDialect();
    String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
    if (columns.length != 1) {
        throw new HibernateException("rlike may only be used with single-column properties");
    }

    if (dialect instanceof MySQLDialect) {
        return columns[0] + " rlike ?";
    }

    if (isOracleDialect(dialect)) {
        return " REGEXP_LIKE (" + columns[0] + ", ?)";
    }

    if (dialect instanceof PostgreSQL81Dialect) {
        return columns[0] + " ~* ?";
    }

    if (dialect instanceof H2Dialect) {
        return columns[0] + " REGEXP ?";
    }

    throw new HibernateException("rlike is not supported with the configured dialect " + dialect.getClass().getCanonicalName());
}
 
源代码3 项目: lams   文件: CriteriaQueryTranslator.java
public CriteriaQueryTranslator(
		final SessionFactoryImplementor factory,
		final CriteriaImpl criteria,
		final String rootEntityName,
		final String rootSQLAlias,
		CriteriaQuery outerQuery) throws HibernateException {
	this( factory, criteria, rootEntityName, rootSQLAlias );
	outerQueryTranslator = outerQuery;
}
 
源代码4 项目: cacheonix-core   文件: CriteriaQueryTranslator.java
public CriteriaQueryTranslator(
		final SessionFactoryImplementor factory,
        final CriteriaImpl criteria,
        final String rootEntityName,
        final String rootSQLAlias,
        CriteriaQuery outerQuery) throws HibernateException {
	this( factory, criteria, rootEntityName, rootSQLAlias );
	outerQueryTranslator = outerQuery;
}
 
源代码5 项目: scheduling   文件: GroupByStatusSortOrder.java
@Override
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
    String column = criteriaQuery.getColumnsUsingProjection(criteria, propertyName)[0];
    return " case " +
           // pending first
           " when " + column + " = " + JobStatus.PENDING.ordinal() + " then 0 " +
           // running, stalled, paused then
           " when " + column + " = " + JobStatus.RUNNING.ordinal() + " then 1 " + " when " + column + " = " +
           JobStatus.STALLED.ordinal() + " then 1 " + " when " + column + " = " + JobStatus.PAUSED.ordinal() +
           " then 1 " +
           // and the rest (killed, finished, etc)
           " else 2 end " + (ascending ? " asc" : " desc");
}
 
源代码6 项目: gorm-hibernate5   文件: RlikeExpression.java
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
    return new TypedValue[] { criteriaQuery.getTypedValue(criteria, propertyName, value.toString()) };
}