我尝试映射来自不同架构的两个表。为每个架构创建了2个数据源。但是在映射时遇到错误。
public class Customer implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@Column(name = "duty_type_id")
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "customerId")
private Long id;
@Column(nullable = false)
private String firstName;
@Column(nullable = false)
private String lastName;
}
public class Order implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
@ManyToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name = "duty_type_id", nullable = false)
private Customer customerId;
}
它的工作没有@mapping注释,(意味着我可以创建没有外键约束的表)。但我需要映射这些表