Re: BUGREPORT : OJB 1.0.5 release candidate 1 (unofficial)
Armin Waibel <[email protected]> Tue, 29 Jan 2008 19:27:39 +0100
| Newsgroups | gmane.comp.jakarta.ojb.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Roger,
thanks for testing the upcoming 1.0.5 release.
Janssen, Roger wrote:
> Hi,
>
> Like a reported earlier, something goes wrong with count queries.
I can reproduce this bug (thanks for detailed description).
>
> When I hack some code in BrokerHelper, to get around the first bug (I
> don't know if what I do is correct, but I am trying):
>
> private Query getReportQueryByCriteriaCount(ReportQueryByCriteria
> aQuery)
> {
> Query cQuery = (Query) getQueryByCriteriaCount(aQuery);
> ReportQueryByCriteria countQuery = null;
>
>
> if(cQuery.getClass().isAssignableFrom(ReportQueryByCriteria.class))
> {
> countQuery = (ReportQueryByCriteria) cQuery;
> }
> else
> {
> countQuery = (ReportQueryByCriteria)((EnclosingReportQuery)
> cQuery).getQuery();
> }
>
> // BRJ: keep the original columns to build the Join
> countQuery.setJoinAttributes(aQuery.getAttributes());
>
> // BRJ: we have to preserve groupby information
> Iterator iter = aQuery.getGroupBy().iterator();
> while(iter.hasNext())
> {
> countQuery.addGroupBy((FieldHelper) iter.next());
> }
>
> return cQuery;
> }
>
> Then i do not get any class cast exceptions anymore.....
I tried the same solution a few minutes ago. This seems fix the bug - my
local test to reproduce the bug pass and no new failures/error occur.
>
> But something is still fishy about the counts in combination with
IN-clauses. It looks like the count query has lost its where clauses
> when I have IN-clauses in the query.
>
ok, that's bad luck. I will try to reproduce this new problem too.
regards,
Armin
>
> [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR:
> org.apache.ojb.broker.PersistenceBrokerSQLException:
> The root stack trace is -->
> * SQLException during execution of sql-statement:
> java.sql.SQLException: Not a condition in statement [select count(*)
> from (SELECT DISTINCT A0.ID FROM IBANX_PERMIT A0 WHERE null ) ojb_enc]
> * sql statement: select count(*) from (SELECT DISTINCT A0.ID FROM
> IBANX_PERMIT A0 WHERE null ) ojb_enc
> at org.hsqldb.jdbc.Util.throwError(Unknown Source)
> * Exception message: Not a condition in statement [select count(*) from
> (SELECT DISTINCT A0.ID FROM IBANX_PERMIT A0 WHERE null ) ojb_enc]
> at org.hsqldb.jdbc.jdbcPreparedStatement.executeQuery(Unknown
> Source)
> * Vendor error code: -106
> at
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
> Source)
> * SQL state code: S1000
> at
> org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown
> Source)
> **
> at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown
> Source)
> at
> org.apache.ojb.broker.util.ExceptionHelper.generateException(Unknown
> Source)
> at
> org.apache.ojb.broker.accesslayer.ReportQueryRsIterator.<init>(Unknown
> Source)
> at
> org.apache.ojb.broker.util.ExceptionHelper.generateException(Unknown
> Source)
> at
> org.apache.ojb.broker.core.ReportRsIteratorFactoryImpl.createRsIterator(
> Unknown Source)
> at
> org.apache.ojb.broker.util.ExceptionHelper.generateException(Unknown
> Source)
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(
> Unknown Source)
> at
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReportQueryIteratorF
> romQuery(Unknown Source)
> at
> org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReportQueryIteratorB
> yQuery(Unknown Source)
> at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown
> Source)
> at
> org.apache.ojb.broker.accesslayer.ReportQueryRsIterator.<init>(Unknown
> Source)
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCount(Unknown
> Source)
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCount(Unknown
> Source)
> at
> org.apache.ojb.broker.core.ReportRsIteratorFactoryImpl.createRsIterator(
> Unknown Source)
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCount(Unknown
> Source)
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(
> Unknown Source)
>
>
>
> Greetings,
>
> Roger Janssen
> iBanx
> *************************************************************************
> The information contained in this communication is confidential and is intended solely for the use of the individual or entity to whom it is addressed.You should not copy, disclose or distribute this communication without the authority of iBanx bv. iBanx bv is neither liable for the proper and complete transmission of the information has been maintained nor that the communication is free of viruses, interceptions or interference.
>
> If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>