Good Day,
I am trying to make a class extends relationship between several classes, and I have found now luck in examples to do this, this should be rather simple I would think, but don't seem to find the right thing, so here is what I am asking for.
Code:
public abstract class Resource implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column protected String id;
public Resource(String id){
this.id = id;
}
Code:
public abstract class RtTemplate extends Resource implements Comparable<RtTemplate>, Serializable {
private static final long serialVersionUID = 1L;
@Column(name="iuia", length=150, nullable=false, unique=true)
protected String iuia;
public RtTemplate(String id, String iuia){
super(id);
this.iuia = iuia;
}
Code:
public class Relation extends RtTemplate implements Serializable {
private static final long serialVersionUID = 1L;
@Column protected String iuip;
@Column protected StandardPrediction ta;
@Column protected StandardPrediction tr;
public Relation(String id, String iuia, String iuip, StandardPrediction ta, StandardPrediction tr){
super(id, iuia);
this.iuip = iuip;
this.iuia = iuia;
this.tr = tr;
this.ta = ta;
}
Code:
@Entity
@Table(name="pton")
public class PtoN extends Relation implements Serializable {
private static final long serialVersionUID = 1L;
@Column protected String nt;
@Column protected String n;
@Column protected String iuic;
public PtoN(String id, String iuip, String iuia, String iuic, String nt, String n, StandardPrediction ta, StandardPrediction tr){
super(id, iuia, iuip, ta, tr);
this.nt = nt;
this.n = n;
this.iuic = iuic;
}
this is the setup, and I have other Pto? classes that do the same think, so I need a little help to map these classes.
and do I need the hashcode and equals in all classes????
and put this all in one table.
thanks in advance,