I’m new to JDO specification and Datanucleus implementations and i’m struggling right now in my Project with the error described above.
What steps will reproduce the Problem:
1- Defining a Class “DefaultDiffTask”:
`@PersistenceCapable
public class DefaultDiffTask implements IDiffTask, Serializable {
@Persistent
protected IDiffTaskTarget diffTaskTarget;
@Persistent
protected String diffTaskId;
protected IDiffTaskPhasesMgr diffTaskPhasesMgr;
@Persistent
protected IDiffTaskType diffTaskType;
@Persistent
protected String taskCreationTime;
public DefaultDiffTask() {
this.diffTaskTarget = new DefaultDiffTaskTarget(
new DefaultPageStateLocation(""), new DefaultPageStateLocation(
""));
this.diffTaskPhasesMgr = new DefaultDiffTaskPhasesMgr(this); //
DiffTaskUtility.createTaskPhasesMgr(this);
this.diffTaskType = new DefaultDiffTaskType(
DiffTaskTypeEnum.CRAWLER_BASED_DIFF);
this.taskCreationTime = (new Date()).toString();
this.diffTaskId = this.generateDiffTaskId();
}
public DefaultDiffTask(IDiffTaskTarget diffTaskArea,
IDiffTaskType diffTaskType) {
this.diffTaskTarget = diffTaskArea;
this.diffTaskPhasesMgr = new DefaultDiffTaskPhasesMgr(this); // DiffTaskUtility.createTaskPhasesMgr(this);
this.diffTaskType = diffTaskType;
this.taskCreationTime = (new Date()).toString();
this.diffTaskId = this.generateDiffTaskId();
}
...........`
2- try to retrieve some previously stored object with :
PersistenceManagerFactory pmf = JDOHelper
.getPersistenceManagerFactory(.....);
// Persistence of a Product and a Book.
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
System.out.println("Retrieving Extent for Default");
Extent e = pm.getExtent(DefaultDiffTask.class, true);
Iterator iter = e.iterator();
while (iter.hasNext()) {
Object obj = iter.next();
System.out.println("> "
+ ((DefaultDiffTask) obj).getDiffTaskId());
}
tx.commit();
} catch (Exception e) {
System.out.println("Exception thrown during retrieval of Extent : "
+ e.getMessage());
} finally {
if (tx.isActive())
tx.rollback();
pm.close();
}
the expected output:
Retrieving Extent for Default:
something here
But i get he following exception:
Retrieving Extent for Default
Exception thrown during retrieval of Extent : Field "net.she.sw.diff2w3c.diff.tsk.DefaultDiffTask.diffTaskTarget" is declared as a reference type (interface/Object) but **no implementation classes** of "net.she.sw.diff2w3c.diff.tsk.target.IDiffTaskTarget" have been found!
my point is, i have some implementation of the interface net.she.sw.diff2w3c.diff.tsk.DefaultDiffTask.diffTaskTarget which have the annotation “@PersistenceCapable” like:
@PersistenceCapable
public class DefaultDiffTaskTarget extends AbstractDiffTaskTarget {
public DefaultDiffTaskTarget(IDiffTaskTargetStateLocation firstLocation,
IDiffTaskTargetStateLocation secondLocation) {
super(firstLocation, secondLocation);
// TODO Auto-generated constructor stub
}
or
@PersistenceCapable
public class DefaultDiffTaskTarget extends AbstractDiffTaskTarget {
or
@PersistenceCapable
public class PageAreaTarget extends AbstractDiffTaskTarget {
this object are injected in the constructors (default and custom) when a DefaulfDiffTask get created…
so my point is
- Why this error ?
- is it something i am missing ?
- all the implementation of the implementations of the interface IDiffTaskTargetare present in the classpath AND have the Annotations for the JDO/Datanucleus to work
i know the problem is on my code and not on the side of JDO/Datanucleus,
and i will be greatful for any given help
How does DataNucleus know of your other classes ? you expect it to guess where they are ? Why not just specify them as per the docs http://www.datanucleus.org/products/accessplatform/jdo/orm/interfaces.html