I have a series on ActiveObject entities in my JIRA plugin.
public interface AT extends Template {
@OneToMany(reverse = "getAT")
public ComponentOrder[] getOrders();
}
@Polymorphic
public interface CT extends Template {
@OneToMany(reverse = "getCT")
public ComponentOrder[] getOrders();
}
public interface IT extends CT {
public String getAttribute();
public void setAttribute(String attribute);
}
public interface ComponentOrder extends Entity {
public AT getAT();
public void setAT(AT at);
public CT getCT();
public void setCT(CT ct);
public int getOrder();
public void setOrder(int order);
public static class ComponentOrderComparator implements Comparator<ComponentOrder> {
@Override
public int compare(ComponentOrder o1, ComponentOrder o2) {
return Integer.compare(o1.getOrder(), o2.getOrder());
}
}
}
Template extends Entity.
The values I have in ComponentOrder are valid. Each entry points to one AT and one CT (plus containing the order).
If I get the list of AT, when I call getOrders(), it returns the correct objects from ComponentOrder.
//I specifically get one AT to get the number of components attached
int number = ao.find(AT.class)[2].getOrders().length;
However, if I get the list of IT, the number of components is zero.
int number = ao.find(IT.class)[0].getOrders().length;
If I search directly in ComponentOrder, I can can both the AT and CT without issue.
String nameAT = ao.find(ComponentOrder.class)[0].getAT().getName();
String nameCT = ao.find(ComponentOrder.class)[0].getCT().getName();
Has it something to do with the fact that my ComponentOrder entity points to a polymorphic object?