One problem is here:
Code:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "item")
@JoinColumn(name = "bitm_numb", referencedColumnName = "bitm_numb_chld")
private List<Sos> sos;
First of all, you should not have mappedBy and @JoinColumn in the same relationship. Second and most importantly, property "item" in Sos is int, but Hibernate expects, as in any inverse relationship, that property "item" is of type DpacRelt.
Here is how your entities should look like:
Code:
@Entity
@Table(name = "dpac_relt", schema = "dcs3000")
public class DpacRelt
{
@Id
@Column(name = "bitm_numb_parn")
private int parent;
@Column(name = "bitm_numb_chld")
private int child;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "item")
private List<Sos> sos;
public int getParent()
{
return parent;
}
public void setParent(int parent)
{
this.parent = parent;
}
public int getChild()
{
return child;
}
public void setChild(int child)
{
this.child = child;
}
public List<Sos> getSos()
{
return sos;
}
public void setSos(List<Sos> sos)
{
this.sos = sos;
}
}
Code:
@Entity
@Table(name = "sos", schema = "dcs3000")
public class Sos
{
@Id
@Column(name = "sos_numb")
private int sos;
@ManyToOne
@JoinColumn(name = "sos_item")
private DpacRelt item;
public int getSos()
{
return sos;
}
public void setSos(int sos)
{
this.sos = sos;
}
public DpacRelt getItem()
{
return item;
}
public void setItem(DpacRelt item)
{
this.item = item;
}
}
Finally, I would recommend you to make your mapping closer to the requirements. I say that because I would expect "parent" and "child" to be some relationship instead of just ints. Also, an entity named Sos with a property of the same name seems odd.
Regards,
Henrique