SizeExpressionpublic class SizeExpression extends Object implements Criterion
Fields Summary |
---|
private final String | propertyName | private final int | size | private final String | op |
Constructors Summary |
---|
protected SizeExpression(String propertyName, int size, String op)
this.propertyName = propertyName;
this.size = size;
this.op = op;
|
Methods Summary |
---|
public org.hibernate.engine.TypedValue[] | getTypedValues(org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)
return new TypedValue[] {
new TypedValue( Hibernate.INTEGER, new Integer(size), EntityMode.POJO )
};
| public java.lang.String | toSqlString(org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)
String role = criteriaQuery.getEntityName(criteria, propertyName) +
'." +
criteriaQuery.getPropertyName(propertyName);
QueryableCollection cp = (QueryableCollection) criteriaQuery.getFactory()
.getCollectionPersister(role);
//String[] fk = StringHelper.qualify( "collection_", cp.getKeyColumnNames() );
String[] fk = cp.getKeyColumnNames();
String[] pk = ( (Loadable) cp.getOwnerEntityPersister() ).getIdentifierColumnNames(); //TODO: handle property-ref
return "? " +
op +
" (select count(*) from " +
cp.getTableName() +
//" collection_ where " +
" where " +
new ConditionFragment()
.setTableAlias( criteriaQuery.getSQLAlias(criteria, propertyName) )
.setCondition(pk, fk)
.toFragmentString() +
")";
| public java.lang.String | toString()
return propertyName + ".size" + op + size;
|
|