Spring Data: fetching full entity from multiple data source with spring jpa

Viewed 214

I have 2 entities from 2 different data sources.

Purchase - data source A

Merchant - data source B

And they have one to one relationship.

I defined the Purchase entity as below.

I want when fetching purchase entity, it also takes into account the merchant from the second datasource.

Is it possible?

@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;
}

0 Answers
Related