Yes - createFilter actually creates a Query object. Maybe the code makes more sense like this:-
Code:
Query kittenColorFilterQuery = session.createFilter(pk.getKittens(), "where this.color = ?");
kittenColorFilterQuery.setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class));
Collection blackKittens = kittenColorFilterQuery.list();
pk.getKittens() is the original mapped collection.
Color.BLACK is the value that we're setting for the parameter in the query and Hibernate.custom(ColorUserType.class) is its type.
"where this.color = ?" is the entire query supplied by the user - Hibernate introduces its own from clause to match to collection and aliases the elements to 'this'.
Hope that helps,
Cheers,
Rich.