Re: [OJB-developers] OQL bug
Brought to you by:
thma
From: Georg S. <ge...@me...> - 2002-03-08 18:45:06
|
Hi, I thought a little bit about my last posting and of course the thing I did was quite stupid since interfaces can not have fields. The query would have to be select allX from X where sequence.getSomeField() = $1 I do not know if this is correct OQL and even then it would be a performance problem because the query engine would have to load each object to invoke the method. Anyway let me explain why I even got to that problem. I actually wanted to do something like this: select allX from X where sequence= $1 sequence is a reference field that holds an interface of type Sequence. Please correct me if this is not possible in OQL, but I thought that I could pass in an object when binding. My problem was that I passed in an object which is loaded with dynamic proxy turned on. The query engine than threw an error that it did not know a class $Proxy2. Somehow the engine should substitute the actual interface or object for the proxy. regards Georg On Fri, 8 Mar 2002, Georg Schneider wrote: > Hi, > > when something similar as the following OQL-Query > > select allX from X where sequence.somefield = $1 .... > > where the sequence field is actually an interface I get a > NullPointerException: > > java.lang.NullPointerException > at > ojb.broker.metadata.ClassDescriptor.getPkFields(ClassDescriptor.java:869) > at > ojb.broker.accesslayer.SqlGenerator$JoinInfo.asSqlClause(SqlGenerator.java:66) > at > ojb.broker.accesslayer.SqlGenerator.getJoinClause(SqlGenerator.java:914) > at > ojb.broker.accesslayer.SqlGenerator.getPreparedSelectStatement(SqlGenerator.java:685) > at > ojb.broker.accesslayer.JdbcAccess.executeQuery(JdbcAccess.java:186) > at ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:179) > at > ojb.broker.singlevm.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1181) > at > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:901) > at > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:986) > at > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:958) > at ojb.odmg.oql.OQLQueryImpl.execute(OQLQueryImpl.java:229) > > > I looked a little bit around and the problem seems to be in the inner > class JoinInfo in SqlGenerator which tries to do the following > > refCld = > aCld.getRepository().getDescriptorFor(anOrd.getItemClass()); > > > anOrd.getItemClass() of course is an interface which as a Descriptor > doesn't have any fields. I suppose the interface would have to be > substituted somehow by the actual classes implementing that interface and > maybe this would mean having to do various actual SQL-Queries each with a > concrete class and then somehow merging the result, or doing an > (outer) join over all the concrete class tables involved and then somehow > postprocessing the result again. > > regards > > Georg > > > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > |