Hi,

I found a bug in Criteria.java. After deserialization, all
criterion are mangled... a criterion of

product.PRODUCT_ID = "1234"

becomes

product.PRODUCT_ID = "product.PRODUCT_ID=='1234'"

(or something like that - you get my point).

Anyway, the problem is that Criteria.add (String, Object)
takes objects (typically Strings, Integers, etc... I guess)
and constructs Criterion out of them. But in deserialization
Criteria.add (String, Object) gets called by the Hashtable
deserializer with the Criterion as the object - so a
Criterion gets built around the String value of a Criterion.
Not good!

The simple fix is to modify the add (String, Object)
function to check if it's being called with a Criterion:

    public Criteria add (String column, Object value)
    {
        if (value instanceof Criterion)
          {
            super.put (column, value);
          }
        else
          {
            add(column, value, EQUAL);
          }
        return this;
    }

There may be a more elegant solution. But this works for me.

Cheers,

Erik


--
To unsubscribe, e-mail:   <mailto:turbine-torque-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-torque-dev-help@;jakarta.apache.org>

Reply via email to