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
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
