db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <tom...@gmail.com>
Subject Do query criterias use field conversions ?
Date Wed, 08 Jun 2005 12:37:18 GMT
Hi folks,

in one of my projects, I use the enums from commons-lang extensively.
In the database I usually map them to SMALLINT or similar, and have
corresponding field conversions defined.

Now, if I want to query for objects like so:

public class Test
  private SomeEnum attr = SomeEnum.DEFAULT_VALUE;

Criteria criteria = new Criteria();

criteria.addEqualTo("attr", SomeEnum.OTHER_VALUE);

// using Spring's PersistenceBrokerDaoSupport
Collection objs =
QueryByCriteria(Test.class, criteria));

then I get an exception like this (from PostgreSQL)

"Der in SQL für eine Instanz von SomeEnum zu verwendende Datentyp kann
nicht abgeleitet werden. Benutzen Sie setObject() mit einem expliziten
Typ, um ihn festzulegen."

i.e., it seems that the enum value that is compared against, is not
passed through the field conversation defined for the field. Is that
correct ?


To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message