Resolved issue: 647

 CriteriaQuery don't support "$type"
This is not the safest way to ensure the functionality works, really you should check the value returned from the DB is the same as the one you expect.