You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Olaf Meske <ol...@iqnex.com> on 2003/03/05 17:38:38 UTC
Problem with ODMG, query , DList and ClassNotPersistenceCapableException
Hi everybody,
My installation worked well with the PersistenceBroker API, but then I
noticed that I have to use the ODMG implementation, for my special
problem with updating contained collections.
I've got problems doing a simple query with the odmg implementation.
I searched the mailing list for similar problems, but I found no hints
for my problem. I use only the newest ojb 0.9.9 with all jars and config
files.
I try to get a collection with all entries of my table:
Java source code:
[...]
public ODMGCampaignDatastore() {
odmg = OJB.getInstance();
Database db = odmg.newDatabase();
try {
db.open("default", Database.OPEN_READ_WRITE);
} catch (ODMGException ex) {
logger.error(ex);
}
}
[...]
Campaign campaign = null;
DList tempList = null;
try {
Transaction tx = odmg.newTransaction();
tx.begin();
OQLQuery query = odmg.newOQLQuery();
query.create("select campaign from "
+ Campaign.class.getName() +" where id="+id);
tempList = (DList) query.execute();
campaign = (Campaign) tempList.get(0);
tx.commit();
} catch (Exception e) {
logger.error(e);
}
[...]
All I got is a stacktrace with:
[...]
[ojb.odmg.collections.DListImpl] - generateNewId(298) - - Generation of
new id failed
org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException:
org.apache.ojb.odmg.collections.DListImpl not found in OJB Repository
at
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(DescriptorRepository.java:305)
at
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(DescriptorRepository.java:318)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getClassDescriptor(PersistenceBrokerImpl.java:1969)
at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getClassDescriptor(DelegatingPersistenceBroker.java:252)
at
org.apache.ojb.odmg.collections.DListImpl.generateNewId(DListImpl.java:293)
at org.apache.ojb.odmg.collections.DListImpl.<init>(DListImpl.java:117)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1233)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1363)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1342)
at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:284)
at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(OQLQueryImpl.java:282)
at
com.iqnex.dpagkamdia.campaign.ODMGCampaignDatastore.getCampaignById(ODMGCampaignDatastore.java:98)
[...]
All I changed in my OBJ.properties are the log4 properties.
I tried to get fix the problem with query like
query.create("select * from "
+ Campaign.class.getName() +" where id="+id);
But all I get was:
[...]
com.iqnex.dpagkamdia.searchEngine.DatastoreException:
java.lang.NullPointerException
at
com.iqnex.dpagkamdia.campaign.ODMGCampaignDatastore.getCampaignById(ODMGCampaignDatastore.java:100)
[...]
Caused by: java.lang.NullPointerException
at org.apache.ojb.odmg.oql.OQLParser.selectQuery(OQLParser.java:172)
at org.apache.ojb.odmg.oql.OQLParser.buildQuery(OQLParser.java:95)
at org.apache.ojb.odmg.oql.OQLQueryImpl.create(OQLQueryImpl.java:237)
at org.apache.ojb.odmg.oql.OQLQueryImpl.create(OQLQueryImpl.java:208)
at
com.iqnex.dpagkamdia.campaign.ODMGCampaignDatastore.getCampaignById(ODMGCampaignDatastore.java:92)
Any help to get this simple query running will be very welcome.
Thanks,
Olaf
Re: Problem with ODMG, query , DList and ClassNotPersistenceCapableException
Posted by Olaf Meske <ol...@iqnex.com>.
Hi ,
Here my own fix :-) It was just my fault.
I found a hint in the new 1.0rc1 distribution.
The ODMG needs some more of the internal tables. The PersistenceBroker
API only needs the OJB_HL_SEQ (thats all i used previously), but the
ODMG needs some more of these tables and these tables have to be in the
database _and_ in the repository_internal.xml :-)
Now everything works fine.
Thanks to all who was about to wrote me an answer.
Olaf