db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiller, Frank RD-AS2" <Frank.Hil...@heidelberg.com>
Subject I would like to replace specific QueryBySQL by general QueryByCriteria
Date Mon, 20 Jun 2005 09:42:23 GMT
Hi OJB users,
I have a database table storing events combined with a timestamp, a
deviceID specifying the device where the event occured and a unique ID.
In some cases I have to know the latest event of a device that occured
before a certain timestamp.
At the moment I use QueryBySQL (see SQL statement below), but this
statement contains the Oracle specific TO_DATE formatter. I'd rather use
QueryByCriteria and define a Criteria object that can replace the SQL
statement (May be I have to use a differnt RDBMS and don't want to
change the source code).
SQL statement as follows:
select * from <tableName> where id = (select max(id) from (select * from
<tableName> where timestamp = (select max(timestamp) from <tableName>
where deviceid = '<deviceID>' and timestamp <

Is there a way to define something like Criteria.addMin(...) or
Criteria.addMax(...) that could be helpful?
Is there a way to define nested queries like I use within the SQL

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message