Skip to content
Advertisement

How to find cortege with OneToMany relation in Spring Data JPA

I use Spring Data JPA and have two entities:

JavaScript

and

JavaScript

And repository:

JavaScript

I need to find available vehicles, which not booked by time. How can I do this?

Advertisement

Answer

I would go for something like:

JavaScript

BTW I think that you might wanna try to change FetchType from EAGER to LAZY for bookingTime and then use join fetch in select query.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement