Hi Armin,

Thanks for taking the time to write a test.

BaseInterface is just an interface. So, it declares only BaseImpl as an
extent-class. BaseImpl declares all attributes (include ojbConcreteClass)
and associations. It also declares AImpl as an extent class.

Could you please email me that test-case, or at least a snippet. Maybe I'm
missing something.

Thanks again.

Joshua Phillips
Contractor (SAIC)
Tel: 301 451 6346
Fax: 301 480 4222
[EMAIL PROTECTED] 

> -----Original Message-----
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Saturday, August 21, 2004 6:21 AM
> To: OJB Users List
> Subject: Re: SqlQueryStatement.splitCriteria -> NullPointerException
> 
> Hi Jakob, Joshua,
> 
> made a test with a modified version of QueryTest#testReportQueryExtent
> against AbstractArticle.class. This test pass. Maybe BaseInterface.class
>   did not declare extents in repository?
> 
> regards,
> Armin
> 
> J.Braeuchi wrote:
> > hi joshua,
> >
> > what version of ojb are you using ?
> > is it ok to use hashcode 0 if no table is available.
> >
> > jakob
> >
> > Phillips, Joshua (NIH/NCI) schrieb:
> >
> >> The collection-descriptor for an abstract class does not have a table
> >> attribute. So, when SqlQueryStatement.splitCriteria is called, a
> >> NullPointerException is thrown when it tries to put the root
> >> TableAlias into
> >> the m_jointTreeToCriteria HashMap, because
> >> SqlQueryStatement.TableAlias.hashCode looks like this:
> >>
> >>         public int hashCode() {
> >>             return table.hashCode();
> >>         }
> >>
> >> ...and table is null.
> >>
> >> The code that I used to produce this error looks like this:
> >>
> >> PersistenceBroker pb = PersistenceBrokerFactory
> >>     .defaultPersistenceBroker();
> >> Criteria subCrit = new Criteria();
> >> subCrit.addEqualTo("id", new Long(1));
> >> ReportQueryByCriteria assocPBQ = QueryFactory.newReportQuery(
> >>     BaseInterface.class, subCrit);
> >> assocPBQ.setAttributes(new String[] { "id" });
> >> Criteria crit = new Criteria();
> >> crit.addIn("base.id", assocPBQ);
> >> QueryByCriteria q = (QueryByCriteria) QueryFactory.newQuery(
> >>     BaseAssocInterface.class, crit, true);
> >> Collection c = pb.getCollectionByQuery(q);
> >>
> >> The stack trace looks like this:
> >>
> >> Caused by: java.lang.NullPointerException
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias.hashCod
> e(
> >>
> >> Unknown Source)
> >>     at java.util.HashMap.hash(HashMap.java:261)
> >>     at java.util.HashMap.put(HashMap.java:379)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.splitCriteria(Unkn
> ow
> >>
> >> n 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.SqlQueryStatement.getSubQuerySQL(Unk
> no
> >>
> >> wn Source)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendSubQuery(Unk
> no
> >>
> >> wn Source)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendParameter(Un
> kn
> >>
> >> own Source)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendInCriteria(U
> nk
> >>
> >> nown Source)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendCriteria(Unk
> no
> >>
> >> wn Source)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendSQLClause(Un
> kn
> >>
> >> own Source)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.asSQLStatement(Unk
> no
> >>
> >> wn Source)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendClause(Unkno
> wn
> >>
> >> Source)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendWhereClause(
> Un
> >>
> >> known Source)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.getStatement(Unkn
> ow
> >>
> >> n Source)
> >>     at
> >>
> org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getPreparedS
> el
> >>
> >> ectStatement(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(Un
> kn
> >>
> >> own Source)
> >>     at
> >>
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unkn
> ow
> >>
> >> n Source)
> >>     at
> >>
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unkno
> wn
> >>
> >> Source)
> >>     ... 20 more
> >>
> >> Joshua Phillips
> >> Contractor (SAIC)
> >> Tel: 301 451 6346
> >> Fax: 301 480 4222
> >> [EMAIL PROTECTED]
> >>
> >> ---------------------------------------------------------------------
> >> 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]
> >
> >
> >
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to