Hi,

I am doing today my usual updated maven depencies for our future product release, so I am migrating my 3.1 code to the new 3.2 generics style and I missed that all the generics code uses just T as "T extends Object" and not "T extends DataObject" (or maybe another superinterface wich makes sense) it is not a serious issue but it can help avoiding runtime errors if you miss the correct class name.

Also I miss a generics typed version of objectForQuery I did it for myself so maybe you can include it in the next version:

// Must add context as parameter
protected <U extends DataObject, T extends Select<U>> U objectForQuery (T query) {
        List<U> objects = getThreadDataContext().select(query);

        if (objects.size() == 0) {
            return null;
        } else if (objects.size() > 1) {
throw new CayenneRuntimeException("Expected zero or one object, instead query matched: " + objects.size());
        }

        return objects.get(0);
    }

I will tell you if I find something worth noting.

Best regards.

Ramiro Aparicio

Reply via email to