List<IFeature> features =
Generics.autoCast(session.createCriteria(Feature.class)
.add(Restrictions.eq(APP_NAME, app))
.add(Restrictions.eq("featType", featureType)).list());
if (features.size() > 1) {
throw new ConstraintException(
"Ambiguity: there are two feature entries for the same feature type ' "
+ featureType.getName() + "' and application #" + app.getID()
+ ": #" + features.get(0).getID() + " and #"
+ features.get(1).getID());
}