I have next class embeddable:
@Data
@Embeddable
public class JobOrderViewPK2 implements Serializable {
private static final long serialVersionUID = 1L;
@Column(name = "ID")
Long id;
@Column(name = "IS_COUNCIL")
Boolean isCouncil;
@Column(name = "ADDRESS_GENERAL_ID")
private Long addressGeneralId;
That is embedded by:
@Entity
@Table(name = "JOB_ORDER_VIEW", schema = "avt")
@Data
public class JobOrderViewEntity2
implements Serializable{
private static final long serialVersionUID = 1L;
@EmbeddedId
private JobOrderViewPK2 id;
@Column(name = "COMMENTS")
private String comments;
@Column(name = "JOB_ORDER_PARENT_ID")
private Long jobOrderParentId;
...
And I want to add relationSheep ManyToOne from jobOrderParentId to id on JobOrderViewEntity2.
But trying:
@Entity
@Table(name = "JOB_ORDER_VIEW", schema = "avt")
@Data
public class JobOrderViewEntity2
implements Serializable{
private static final long serialVersionUID = 1L;
@EmbeddedId
private JobOrderViewPK2 id;
@Column(name = "COMMENTS")
private String comments;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "JOB_ORDER_PARENT_ID", referencedColumnName = "id")
private JobOrderViewEntity2 jobOrderParent;
...
Returns error of wrong number of column.
And trying this:
...
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "JOB_ORDER_PARENT_ID", referencedColumnName = "*id.id*")
private JobOrderViewEntity2 jobOrderParent;
...
Returns error of supertables and secondary tables.
Can I do what I’m trying?