getObjectById throws ClassNotResolvedException

116 views Asked by At

We are using mySQL + JDO + Datanucleus.

When I call pm.getObjectById(type,id); it throws the exception

javax.jdo.JDOUserException: Failed to find the object of with id "org.geppetto.persistence.db.model.GeppettoProject:1"
NestedThrowables:
org.datanucleus.exceptions.ClassNotResolvedException: Class "org.geppetto.persistence.db.model.GeppettoProject" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.

However if before calling it I query the database with something like the following

Query query = pm.newQuery(GeppettoProject.class);
query.execute();

then from that moment on getObjectById starts returning the object. Is this behaviour correct? getObjectById seems to only return things once they are cached, i.e. only after a query was executed. In general I wouldn't like to have to bother with this, if things have to be fetched for the first time then let it be, if they were already fetched give me whatever is cached but I wouldn't expect to have to know about it. Am I missing something?

0

There are 0 answers