Hi,
I created four simple projects :
- the first one using annotations mapping a simple Class,
- the second one using annotations mapping an inherited Class,
- the third one using programmatic API mapping a simple Class,
- and the last one using programmatic API mapping an inherited Class.
Code of the main class:
Code:
public class ActivityDefinition implements Serializable {
private static final long serialVersionUID = -6281358760252663359L;
private String name;
private int priority;
protected ActivityDefinition() {}
public ActivityDefinition(String name, int priority) {
super();
this.name = name;
this.priority = priority;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
...
}
And of the inherited class:
Code:
public class SubActivityDefinition extends ActivityDefinition {
private static final long serialVersionUID = -6848792468747886255L;
protected long dbid;
protected SubActivityDefinition() {}
public SubActivityDefinition(String name, int priority) {
super(name, priority);
}
public Long getDbid() {
return dbid;
}
public void setDbid(Long dbid) {
this.dbid = dbid;
}
}
Everything works properly except when searching on the inherited class using programmatic API: the result list is empty! After several attempts, I found a work around: I have to override getters in the inherited class.
i.e.
Code:
public class InternalActivityDefinition extends ActivityDefinition {
...
public String getName() {
return super.getName();
}
public int getPriority() {
return super.getPriority();
}
...
}
Is there a parameter or a way to avoid this work around?
Regards,
Matti