org.hibernate.MappingException:中断的列映射:terminal.id:com.domain.agent.Agent

时间:2017-12-12 16:32:31

标签: spring-boot hibernate-annotations

我在说明spring boot服务器时遇到异常。我想要内连的第二个表(XYZ)有两个键(AGENTID,TERMID),AGENTID是两个表中的主键。

@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 个答案:

没有答案