Methods Summary |
---|
protected abstract boolean | excludeEmpty()
|
protected org.hibernate.persister.collection.QueryableCollection | getQueryableCollection(java.lang.String entityName, java.lang.String propertyName, org.hibernate.engine.SessionFactoryImplementor factory)
PropertyMapping ownerMapping = ( PropertyMapping ) factory.getEntityPersister( entityName );
Type type = ownerMapping.toType( propertyName );
if ( !type.isCollectionType() ) {
throw new MappingException(
"Property path [" + entityName + "." + propertyName + "] does not reference a collection"
);
}
String role = ( ( CollectionType ) type ).getRole();
try {
return ( QueryableCollection ) factory.getCollectionPersister( role );
}
catch ( ClassCastException cce ) {
throw new QueryException( "collection role is not queryable: " + role );
}
catch ( Exception e ) {
throw new QueryException( "collection role not found: " + role );
}
|
public final org.hibernate.engine.TypedValue[] | getTypedValues(org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)
return NO_VALUES;
|
public final java.lang.String | toSqlString(org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)
String entityName = criteriaQuery.getEntityName( criteria, propertyName );
String actualPropertyName = criteriaQuery.getPropertyName( propertyName );
String sqlAlias = criteriaQuery.getSQLAlias( criteria, propertyName );
SessionFactoryImplementor factory = criteriaQuery.getFactory();
QueryableCollection collectionPersister = getQueryableCollection( entityName, actualPropertyName, factory );
String[] collectionKeys = collectionPersister.getKeyColumnNames();
String[] ownerKeys = ( ( Loadable ) factory.getEntityPersister( entityName ) ).getIdentifierColumnNames();
String innerSelect = "(select 1 from " + collectionPersister.getTableName()
+ " where "
+ new ConditionFragment().setTableAlias( sqlAlias ).setCondition( ownerKeys, collectionKeys ).toFragmentString()
+ ")";
return excludeEmpty()
? "exists " + innerSelect
: "not exists " + innerSelect;
|
public final java.lang.String | toString()
return propertyName + ( excludeEmpty() ? " is not empty" : " is empty" );
|