Harri Kaimio wrote:
Hi,
I am having problems with OJB query criterias that include SQL
functions with several parameters. Here is an actual example that does
not work:
crit.addGreaterOrEqualThan( "subdate("+dateField.getName()
+ ", " + accuracyField.getName() + ")",
date );
Hi Harri,
try to avoid the resolution of the name that OJB do,
write directly the name of the column in the table.
That work for me in the list of attribute, i don't try in the criteria.
I hope this help.
Cheers,
Carlos Chávez.
creates an exception like this:
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(Unknown Source)
at org.apache.ojb.broker.util.SqlHelper.cleanPath(Unknown Source)
at
org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.buildJoinTreeForColumn(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.buildJoinTree(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.splitCriteria(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.<init>(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.<init>(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.<init>(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getPreparedSelectStatement(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
Source)
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.core.RsIteratorFactoryImpl.createRsIterator(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
... 25 more
Based on mail archives & error database this problem seems to be
similar to issue OJB-4 which should be fixed in 1.1 branch. However, I
am otherwise happy with OJB 1.0.4 and not particularly willing to
migrate into non-production branch. So, is there any plan to get the
fix into 1.0.x? Or any other workaround than using native SQL criteria?
BR, Harri
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]