I have been running into this limitation many times the last decade so i figured
it would help others to know the only practical workaround i have found so far :
Just map the same association as many times as you need to join it
so Cat would get two collections : kittens0 and kittens1
then :
Code:
Criteria.createCriteria (Cat.class)
.createAlias ("kittens0", "kittens0").add (Expression.eq ("name", "Fred"))
.createAlias ("kittens1", "kittens1").add (Expression.eq ("name", "Amy"));
does work as intended.
It's but ugly, i know and does puts a limitation on how many time one may join the association
So maybe it could get patched into the criteria API in order to make it transparent to the user...