Criteria.createCriteria(path) throws org.hibernate.QueryException: duplicate association path when we try to create another criteria with the same path.
That may seem reasonable, however, imagine following situation:
Criteria are flexible so you can have some code handling restrictions and some code handling ordering by some "query metadata" provided to the DAO method.
Say you are filtering for a value under some association path 'A' - so you would need subcriteria on 'A' and add a restriction to it. You are sorting according to the association path 'A' so you need the same subcriteria. But you handle setup of sorting in a different place in the code so you naively invoke criteria.createCriteria and get "org.hibernate.QueryException: duplicate association path"
It would be better if Hibernate looks through the set of subcriterias it has (in CriteriaImpl) and returns the one with the same association path.
I guess they would need to be of the same join type...