Spring Data - One Entity To Many Documents

Viewed 20

I keep files entities (AppFile) in MySQL, but their download logs (AppFileLog) are stored as documents in MongoDB.

At document side I have DBRef to entity.

@DBRef
private AppFile file;

At entity side I want to create relationship (OneToMany). As I know (and tested) OneToMany annotation does not apply here. So how can I made reference from MySQL entity to many MongoDB documents and have List in entity?

I'm using spring-boot-starter-data-mongodb and spring-boot-starter-data-jpa in spring boot 2.6.8.

0 Answers
Related