db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: Bug in SqlHelper
Date Sat, 18 Jun 2005 07:48:28 GMT
hi tom,

SqlHelper provides primitive parsing only. however in ojb 1.1 this 
problem should be solved.

jakob

Thomas Dudziak schrieb:
> Hi folks,
> 
> just found a bug in SqlHelper (I would add a bug entry in JIRA but the
 seems to be down).
> Assume that I have an persistent class with two Timestamp columns, say
> 'startTime' and 'endTime', and I want to query for all instances that
> happen after a certain time, say 10 o'clock, regardless of the day.
> With PostgreSQL, I'd use a criteria like:
> 
> criteria.addGreaterOrEqualThan(
>     "DATE_TRUNC('minute', endTime) - DATE_TRUNC('day', endTime) + TIME '00:00'",
>     startTimeToQueryFor);
> 
> However, this fails with a StringIndexOutOfBoundsException in the
> SqlHelper (1.0 branch from CVS):
> 
> java.lang.StringIndexOutOfBoundsException: String index out of range: -2
> 	at java.lang.String.substring(String.java:1768)
> 	at org.apache.ojb.broker.util.SqlHelper.splitPath(SqlHelper.java:112)
> 	at org.apache.ojb.broker.util.SqlHelper.cleanPath(SqlHelper.java:65)
> 	at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.buildJoinTreeForColumn(SqlQueryStatement.java:1646)
> 	at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.buildJoinTree(SqlQueryStatement.java:1628)
> 	at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.splitCriteria(SqlQueryStatement.java:1705)
> 	at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.<init>(SqlQueryStatement.java:145)
> 	at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.<init>(SqlQueryStatement.java:97)
> 	at org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.<init>(SqlSelectStatement.java:51)
at org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getPreparedSelectStatement(SqlGeneratorDefaultImpl.java:150)
> 	at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:318)
> 	at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:72)
> 	at org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:185)
> 	at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58)
> 	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:2047)
> 	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1605)
> 	at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:116)
> 	at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:255)
> 	at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:275)
> 	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1461)
> 	at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:366)
> 	at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:366)
> 
> 
> any ideas ?
> 
> Tom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

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


Mime
View raw message