Hi,
I'm getting a
org.hibernate.PropertyNotFoundException: field not found: numero with this mapping.
The problem is because I don't have the filed
numero in IPT class. Is it mandatory? or is there a way to create this relation without put
numero field in IPT class? It's a simple aggregation and I think that doesn't make sense to create an "auxiliar" field...
Thanks,
André
Femea.java
Code:
public class Femea {
private Integer numero;
private IPT ipt;
}
IPT.java Code:
public class IPT {
private Femea femea;
}
Femea.hbm.xml Code:
<class name="Femea" table="ANIMAL" catalog="REBANHO">
<id name="numero" type="int">
<column name="NR_ANIMAL" />
<generator
class="AnimalIdentifierGenerator" />
</id>
<one-to-one name="ipt" class="IPT" />
</class>
IPT.hbm.xml Code:
<class name="IPT" table="IPT" catalog="REBANHO">
<id name="numero" column="NR_FEMEA">
<generator class="foreign">
<param name="property">femea</param>
</generator>
</id>
<one-to-one name="femea" class="Femea" constrained="true" />
</class>