Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 54321 invoked from network); 5 Apr 2006 18:59:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Apr 2006 18:59:39 -0000 Received: (qmail 94900 invoked by uid 500); 5 Apr 2006 18:59:38 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 94755 invoked by uid 500); 5 Apr 2006 18:59:37 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 6956 invoked by uid 99); 5 Apr 2006 16:42:09 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Message-ID: <1723277776.1144255307290.JavaMail.jira@ajax> Date: Wed, 5 Apr 2006 17:41:47 +0100 (BST) From: "Ryan Harris (JIRA)" To: ojb-dev@db.apache.org Subject: [jira] Commented: (OJB-62) addPathClass in QueryByCriteria does not consider inheritance In-Reply-To: <102258125.1122563859108.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/OJB-62?page=comments#action_12373394 ] Ryan Harris commented on OJB-62: -------------------------------- I've had the same error described in the bug report above. Armin reproduced no error because his test case used slightly a different configuration: Notice in the class descriptor attribute table="tablename" exists in the test case but not the bug report. I tried to fix the source code for my own use but didnt have enough time so I just learned from Armin's successful test case and created an empty table. It didnt immediately work. so I added the expected columns to the class descriptor and to the empty table. The sql generated by ojb started to work again. Here is the documentation on the website that doesnt work as written (for me at least): http://db.apache.org/ojb/docu/guides/advanced-technique.html#Extents (its line 3 in the example) > 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: > > > > > > > > > > > > > > > > > > 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: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org