2

I am getting exception while stating of spring boot server. second table(XYZ) which I want to innerjoin has 2 keys(AGENTID,TERMID) and AGENTID is the primary key in both the tables.

@Entity
@Table(name="abc")
public class Agent {

    @Id
    @Column(name="AGENTID")
    private int agentId;
    @Column(name="AGENTNAME")
    private String agentName;

    @OneToOne(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
    @JoinColumn(name = "AGENTID", unique = false, nullable = true, insertable = true, updatable = true)
    private Terminal terminal;
}

@Entity
@Table(name="xyz")
public class Terminal {


    @EmbeddedId
    private TerminalIds terminalIds;


}

public class TerminalIds implements Serializable{


    private static final long serialVersionUID = 3811257594320593004L;
    @Column(name="AGENTID")
    private int agentId;
    @Column(name="TERMID")
    private String terminalId;


}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.