@Override
    public long execute() {
        Query query = persistenceManager.newQuery(entity.getType());
        if (metadata.getWhere() != null) {
            JDOQLSerializer serializer = new JDOQLSerializer(templates, entity);
            serializer.handle(metadata.getWhere());
            query.setFilter(serializer.toString());
            Map<Object,String> constToLabel = serializer.getConstantToLabel();

            try {
                if (!constToLabel.isEmpty()) {
                    List<Object> constants = new ArrayList<Object>(constToLabel.size());
                    StringBuilder builder = new StringBuilder();
                    for (Map.Entry<Object, String> entry : constToLabel.entrySet()) {
                        if (builder.length() > 0) {
                            builder.append(", ");
                        }
                        builder.append(entry.getKey().getClass().getName()).append(" ");
                        builder.append(entry.getValue());
                        constants.add(entry.getKey());
                    }
                    query.declareParameters(builder.toString());
                    return query.deletePersistentAll(constants.toArray());
                } else {
                    return query.deletePersistentAll();
                }
            } finally {
                query.closeAll();
            }
        } else {
            try {
                return query.deletePersistentAll();
            } finally {
                query.closeAll();
            }
        }
    }
{@link DeleteClause} implementation for JDO

@author tiwe
querydsl-jdo/src/main/java/com/querydsl/jdo/dml/JDODeleteClause.java