The _____ annotation in Spring Data JPA can be used to eagerly fetch the associated entities from the database.

  • @EagerFetch
  • @Fetch
  • @FetchType.EAGER
  • @Fetch.EAGER
The @FetchType.EAGER annotation in Spring Data JPA can be used to eagerly fetch the associated entities from the database. When an entity is loaded, all its associations marked with FetchType.EAGER are fetched immediately along with the main entity, reducing the number of database queries. However, you should use this option judiciously as it can lead to performance issues if overused.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *