Reputation: 569
I have the Exec entity:
@Entity("Exec")
public class Exec {
@Id
private ObjectId id;
private long initDate;
private long endDate;
public enum statuses {
SUCCESS, FAIL, PARTIAL
}
private statuses status;
@Reference(idOnly = true, ignoreMissing = true, lazy = false)
Analysis analysis;
@Reference(idOnly = true, ignoreMissing = true, lazy = true)
Set<Conclusion> conclusions = new HashSet<Conclusion>();
// getters and setters
which has a reference to the Conclusion entity:
@Entity("Conclusion")
public class Conclusion {
@Id
private ObjectId id;
private Map<String, Object> params = new HashMap<String, Object>();
private long initDate;
private long endDate;
public enum statuses {
SUCCESS,
FAILURE
}
private statuses status;
private String errorMessage;
private String stackTrace;
Set<Map<String, Object>> data = new HashSet<Map<String, Object>>();
In the debugger, if I try to get the conclusions
Set<Conclusions> conclusions = mongoWrapper.getDataStore().createQuery(Exec.class).asList().get(0).getConclusions()
I get the following message:
com.sun.jdi.InvocationException occurred invoking method.
If I try to access the object, for example, doing the following:
conclusions.toArray()
it throws a RuntimeException, examining the stack trace:
org.mongodb.morphia.mapping.MappingException: Embedded element isn't a DBObject! How can it be that is a class java.lang.String
I tried changing a bunch of stuff, nothing really worked. Any ideas of what is the matter of the problem?
Upvotes: 3
Views: 437
Reputation: 530
using concrete AnalysisConclusion in a set of Conclusion. remember that annotation are not inherited, then mark AnalysisConclusion with @Entity
Upvotes: 0