[ http://issues.apache.org/jira/browse/OJB-62?page=all ]
Armin Waibel resolved OJB-62:
-----------------------------
Fix Version: 1.0.4
Resolution: Cannot Reproduce
I can't reproduce this issue with latest from CVS (1.0.4). Add new tests
ExtentAwarePathExpressionsTest#testAddClassPathOnQuery_1 and ..._2
The query is build against class Topic which has a subclass TopicExt:
<class-descriptor class="org.apache.ojb.broker.Topic" table="TOPIC">
<extent-class class-ref="org.apache.ojb.broker.TopicExt"/>
</class-descriptor>
Criteria criteria = new Criteria();
criteria.addLike("qualifiers.importance", "impor%");
QueryByCriteria query = QueryFactory.newQuery(BaseContentImpl.class, criteria,
true);
query.addPathClass("qualifiers", Topic.class);
List content = (List) broker.getCollectionByQuery(query);
> addPathClass in QueryByCriteria does not consider inheritance
> -------------------------------------------------------------
>
> Key: OJB-62
> URL: http://issues.apache.org/jira/browse/OJB-62
> Project: OJB
> Type: Bug
> Components: PB-API
> Environment: postgresql, ojb 1.0.3
> Reporter: Kirill Petrov
> Fix For: 1.0.4
>
> I guess there is a bug in the addPathClass method. Orirginally I posted it on
> the mailing list and then you requested me to submit a new bug on this
> website:
> here is the code that I have
> public static Collection findModelsByAuthorsName(String aName) {
> PersistenceBroker broker =
> PersistenceBrokerFactory.defaultPersistenceBroker();
> try{
> Criteria crit = new Criteria();
> crit.addLike("sources.author", aName);
> QueryByCriteria query = new QueryByCriteria(Model.class, crit, true);
> query.addPathClass("sources", Citation.class);
> return broker.getCollectionByQuery(query);
> } finally {
> broker.close();
> }
> }
> when I run it I get an error (below). The problem is that Citation is a
> superclass that has a number of classes that implement it. If instead of
> Citation I use OJBCitation (which is not extended by any class) then
> everything works fine.
> Here is the definition of Citation:
> here is what I have:
> <class-descriptor class="edu.uci.ics.sigmoid.Citation">
> <extent-class class-ref="edu.uci.ics.sigmoid.OJBCitation" />
> <extent-class class-ref="edu.uci.ics.sigmoid.Article" />
> <extent-class class-ref="edu.uci.ics.sigmoid.Book" />
> <extent-class class-ref="edu.uci.ics.sigmoid.Booklet" />
> <extent-class class-ref="edu.uci.ics.sigmoid.Unpublished" />
> <extent-class class-ref="edu.uci.ics.sigmoid.TechReport" />
> <extent-class class-ref="edu.uci.ics.sigmoid.Proceedings" />
> <extent-class class-ref="edu.uci.ics.sigmoid.PhDThesis" />
> <extent-class class-ref="edu.uci.ics.sigmoid.MiscCitation" />
> <extent-class class-ref="edu.uci.ics.sigmoid.MastersThesis" />
> <extent-class class-ref="edu.uci.ics.sigmoid.Manual" />
> <extent-class class-ref="edu.uci.ics.sigmoid.InProceedings" />
> <extent-class class-ref="edu.uci.ics.sigmoid.InCollection" />
> <extent-class class-ref="edu.uci.ics.sigmoid.InBook" />
> <extent-class class-ref="edu.uci.ics.sigmoid.Conference" />
> </class-descriptor>
> Here is the exception I get.
> [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
> createTableAlias2: path: sources* tableAlias: model_sources_knowledge_source
> A1
> [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result
> of getTableAlias(): null A2
> [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
> SQL:SELECT DISTINCT
> A0._id,A0.name,A0.extended_description,A0.license_id,A0.unique_dbid,A0.comment
> FR\
> OM model A0 INNER JOIN (model_sources_knowledge_source A1 INNER JOIN null A2
> ON A1.knowledge_source_id=A2._id) ON A0._id=A1.model_id WHERE author LIKE ?
> [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: SQLException during
> the execution of the query (for edu.uci.ics.sigmoid.OJBModel): ERROR: syntax
> error at or near \
> "null"
> ERROR: syntax error at or near "null"
> java.sql.SQLException: ERROR: syntax error at or near "null"
> at
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
> at
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
> at
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:240)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]