Spring Data:使用Spring JPA从多个数据源获取完整实体

问题描述

我有2个来自2个不同数据源的实体。

Purchase-数据源A

Merchant-数据源B

他们之间存在一对一的关系。

我如下定义了Purchase实体。

我想在获取购买实体时也考虑了 第二个数据源。

有可能吗?

@Data
@Entity
@Table(name = "purchase")
@Builder
public class Purchase extends BaseEntity {
    // ... other properties

    **// I want when fetching purchase entity,it also takes into account the merchant from
    // the second datasource.**
    // @Transient
    protected Merchant merchant;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)