@SuppressWarnings("unchecked")
    private void addEntityRestrictions(Restriction query, ExtendedField field,
        Object patternObject) {

        Restriction subPart = null;

        if (field.isMappedAsList()) {
            List<Object> liste = (List<Object>) field.getValue(patternObject);

            if (liste != null) {
                subPart = new Restriction();

                for (Object object : liste) {
                    Restriction restriction = this.buildRestriction(object, field.getMappedType());

                    if (!restriction.isEmpty()) {
                        subPart.addOr();
                        subPart.add(restriction);
                    }

                }


            }
        } else {
            subPart = this.buildRestriction(field.getValue(patternObject), field.getMappedType());
        }

        if (subPart != null && !subPart.isEmpty()) {
            query.addAnd();
            query.add(subPart);
        }
    }