I correct my repository definition (remove the table attribut from PersonBaseImpl descriptor) but I still get an exception.
Any idea about it ?
Thanks.
------------------------------------------------
java.lang.NullPointerException
at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias.hashCode(Unknown Source)
at java.util.HashMap.hash(HashMap.java:250)
at java.util.HashMap.put(HashMap.java:363)
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.SqlSelectStatement.<init>(Unknown Source)
at org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getSelectStatementDep(Unknown Source)
at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(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.PersistenceBrokerImpl.getIteratorByQuery(Unknown Source)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getIteratorByQuery(Unknown Source)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getIteratorByQuery(Unknown Source)
at org.apache.ojb.jdori.sql.OjbExtent.<init>(Unknown Source)
at org.apache.ojb.jdori.sql.OjbStoreManager.getExtent(Unknown Source)
at com.sun.jdori.common.PersistenceManagerImpl.getExtent(Unknown Source)
at com.sun.jdori.common.PersistenceManagerWrapper.getExtent(Unknown Source)
Thomas Mahler wrote:
Hi Christophe,
You have to define the inheritance relationship the other way round. You have to define PersonBaseImpl as an abstract class and add an extent-class pointer to ST_Person.
As in the following example:
<class-descriptor class="demo1.PersonBaseImpl" > <extent-class class-ref="demo1.ST_Person" /> </class-descriptor>
<class-descriptor class="demo1.ST_Person" table="PERSON" > ...
cheers, Thomas
Christophe.Demarey wrote:
Hi,
I have a persistent class (contains all persistent fields) ST_Person.
I have a base implementation (implements business methods) PersonBaseImpl that inherits from ST_Person.
I wrote in the repository an extent tag for this but I don't wrote a tag for PersonBaseImpl. I think this was the problem.
Must we declare such a class ?
I do this but I get the following error. Is something missing in my code ? What I'm doing wrong?
Best Regards.
----------------
java.lang.NullPointerException
at org.apache.ojb.broker.metadata.ClassDescriptor.getPkFields(Unknown Source)
at org.apache.ojb.broker.accesslayer.RsIterator.getIdentityFromResultSet(Unknown Source)
at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown Source)
at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
at com.sun.jdori.common.query.BasicQueryResult.<init>(Unknown Source)
at org.apache.ojb.jdori.sql.OjbStoreManager.newQueryResult(Unknown Source)
at com.sun.jdori.common.query.QueryImpl.executeWithArray(Unknown Source)
at ....
[org.apache.ojb.broker.accesslayer.RsIterator] ERROR: null
java.lang.NullPointerException
at org.apache.ojb.broker.metadata.ClassDescriptor.getPkFields(Unknown Source)
at org.apache.ojb.broker.accesslayer.RsIterator.getIdentityFromResultSet(Unknown Source)
at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown Source)
at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
at com.sun.jdori.common.query.BasicQueryResult.<init>(Unknown Source)
at org.apache.ojb.jdori.sql.OjbStoreManager.newQueryResult(Unknown Source)
at com.sun.jdori.common.query.QueryImpl.executeWithArray(Unknown Source)
at ....
Danilo Tommasina wrote:
Please post your repository.xml descriptor, it seems that you have a loop in your config.
bye danilo
Hi,
I didn't have any feedback about my last mail and I don't know how to solve this problem.
As I'm not sure JDO queries work fine, I test the following piece of code. But I always got a "java.lang.StackOverflowError" exception.
( Before this query, classes were enhanced with a jdo file - I want to use the OJB JDO api).
I really need to run OJB queries. Can anyone help me?
Thanks, Christophe.
My code : ==========
// Get an OJB Broker org.apache.ojb.broker.PersistenceBroker broker = null; try { broker = org.apache.ojb.broker.PersistenceBrokerFactory. defaultPersistenceBroker(); } catch (Throwable t) { t.printStackTrace(); }
// Create the OJB query org.apache.ojb.broker.query.Query q = null; org.apache.ojb.broker.query.Criteria crit = null; java.util.Collection results = null;
crit = new org.apache.ojb.broker.query.Criteria(); crit.addEqualTo("_firstName_state", first_name); crit.addEqualTo("_lastName_state", last_name);
org.apache.ojb.broker.query.QueryFactory.newQuery(demo1.ST_Person.class,crit);
try { // ask the broker to retrieve the Extent collection results = broker.getCollectionByQuery(q); // now iterate over the result java.util.Iterator iter = results.iterator(); while (iter.hasNext()) { System.out.println(iter.next()); } } catch (Throwable t) { t.printStackTrace(); }
The error output :
==================
java.lang.StackOverflowError
at org.apache.ojb.broker.metadata.DescriptorRepository.discoverDescriptor(Unknown Source)
at org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown Source)
at org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
at org.apache.ojb.broker.query.QueryFactory.getExtentClasses(Unknown Source)
....
------------------------------------------------------------------------
<!-- Please keep user defined mappings in this file only to avoid mixing user defined and system mappings. --> <!-- Mapping of User defined classes starts here -->
<class-descriptor class="demo1.ST_Address" table="ADDRESS" > <field-descriptor name="_addressLine1_state" column="ADR1" jdbc-type="VARCHAR" primarykey="true" /> <field-descriptor name="_addressLine2_state" column="ADR2" jdbc-type="VARCHAR" /> <field-descriptor name="_city_state" column="CITY" jdbc-type="VARCHAR" /> <field-descriptor name="_zip_state" column="ZIP" jdbc-type="VARCHAR" /> <field-descriptor name="_sh_rid" column="SH_RID" jdbc-type="VARCHAR" /> </class-descriptor>
<class-descriptor class="demo1.PersonBaseImpl" table="PERSON" > </class-descriptor>
<class-descriptor class="demo1.ST_Person" table="PERSON" > <extent-class class-ref="demo1.PersonBaseImpl" /> <field-descriptor name="_firstName_state" column="FIRST_NAME" jdbc-type="VARCHAR" primarykey="true" /> <field-descriptor name="_lastName_state" column="LAST_NAME" jdbc-type="VARCHAR" primarykey="true" /> <field-descriptor name="_age_state" column="AGE" jdbc-type="INTEGER" /> <field-descriptor name="_adress_state" column="ADDRESS" jdbc-type="VARBINARY" /> <field-descriptor name="_sh_rid" column="SH_RID" jdbc-type="VARCHAR" /> </class-descriptor>
<!-- Mapping of User defined classes ends here -->
------------------------------------------------------------------------
--------------------------------------------------------------------- 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]
-- Christophe Demarey, Research engineer OpenCCM project - http://www.objectweb.org/openccm GOAL Team - CNRS/USTL/LIFL - http://www.lifl.fr/GOAL/ Universite des Sciences et Technologies de Lille LIFL - UMR CNRS 8022- Batiment M3 59655 Villeneuve d'Ascq Cedex - FRANCE Phone: +33 (0)32043 4728 Fax : +33 (0)32043 6566
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
