Hi Emanuel.
I didn't attach the header of the orm.xml file as I though it wasn't relevant (see it below). The file does contain the <xml-mapping-metadata-complete/> tag.
Code:
<persistence-unit-metadata>
<xml-mapping-metadata-complete/>
<persistence-unit-defaults>
<access>PROPERTY</access>
</persistence-unit-defaults>
</persistence-unit-metadata>
As for the mapping, the Vet class wraps the mapped visit with some getter/setter methods which provide some application logic. I've posted the class below (the code it's let's say legacy so heavy modifications to it are not allowed at the moment):
Code:
public class Pet extends NamedEntity {
private Owner owner;
private Set visits;
protected void setVisitsInternal(Set visits) {
this.visits = visits;
}
protected Set getVisitsInternal() {
if (this.visits == null) {
this.visits = new HashSet();
}
return this.visits;
}
public List getVisits() {
List sortedVisits = new ArrayList(getVisitsInternal());
PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
return Collections.unmodifiableList(sortedVisits);
}
public void addVisit(Visit visit) {
getVisitsInternal().add(visit);
visit.setPet(this);
}
}
As you can see the internal visit set gets translated into a list. However, the getVisits() is used only inside the application (that's why there is no setter for it). However, the getter/setter for internalVisits are in place (and with the correct type).
By the look of the exception, seems that the wrong property getVisits is being picked up (not sure why).
Thanks for your help![/code]