Is my relationships mapping correct?


I have lost touch of relationships mapping in JPA because I didn’t have chance to work on JPA for many years, so I hope I can get some feedback on my entities’ mapping because I still need to know how Springboot works which makes me crazy…

The use case is based on

Here’s my relationship mapping:
pet entitiy -
order entity -
user entity -
photo entity -
category entity - - not sure if I have to create a one to many here?

Thank you.,

Nobody other than you can tell if your mapping is correct :wink:

You can always declare bi-directional associations if you want, usually they help with querying from the other side, but it’s not required. I’d suggest, add the inverse relationship when you see the need.