Home > Blockchain >  OneToMany Relation not returning all values in db
OneToMany Relation not returning all values in db

Time:12-08

I have two entries (OrderProduct) in the database pointing at the same parent (ShopOrder) entry. But when I fetch the parent entry it only contains one of the child entries in the @OneToMany List. I'm not sure what I'm doing wrong.

ShopOrder DBO ShopOrder DBO

ProductOrder entries in the DB ProductOrder in DB

Getting the ShopProducts Getting all ShopProducts

What I'm getting out of the DB Display of output

I'll gladly provide more info/code snippets if necessary. Thank you in advance!

CodePudding user response:

I mapped the wrong field. I should've mapped it by the foreign key instead of id.

Correct mapping

  • Related