I get an exception when creating the tables. I understood the problem but how do I solve this?
Exception:
Invocation of init method failed; nested exception is org.hibernate.AnnotationExcepti
on: A Foreign key refering com.kids.crm.db.Truck from com.kids.crm.db.TruckWoodP
rice has the wrong number of column. should be 2
Code:
@Entity
@IdClass (TruckWoodPriceId.class)
@Table(name = "truck_wood_price")
public class TruckWoodPrice {
@Id
private Truck truck;
@Id
private WoodType woodType;
@Id
private Double price;
@Id
private Integer truckYear;
//getters and setters
}
@Embeddable
public class TruckWoodPriceId{
private Truck truck;
private WoodType woodType;
private Double price;
private Integer truckYear;
//getters and setters
}
@Entity
@IdClass (TruckId.class)
@Table(name = "truck")
public class Truck extends Persistent{
@Id
private Long id;
private Double cft;.
@Id
private Integer truckYear;
private WholeSaleMember wholeSaleMember;
//getters and setters
}
@Embeddable
public class TruckId implements Serializable{
private Long id;
private Integer truckYear;
}