You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The findAll method from the JpaRepository is a terrible anti-pattern as it allows you to fetch an entire database table with a single method call. Such methods have no purpose in a non-trivial application, so this method should be deprecated.
If you really want to fetch an entire database table, then you should do that explicitly with a JPQL call in the context where this is needed.
The text was updated successfully, but these errors were encountered:
vladmihalcea
changed the title
HibernateRepository deprecates the findAll method from the JpaRepository
The findAll method from the JpaRepository is an Anti-Pattern and the HibernateRepository should deprecate it
Sep 10, 2022
The article about this topic will be published tomorrow.
It's a very dangerous method that can fetch an entire database table, and it encourages inexperienced devs to use Java,Stream filter/map instead of using WHERE/SELECT in SQL.
The
findAll
method from theJpaRepository
is a terrible anti-pattern as it allows you to fetch an entire database table with a single method call. Such methods have no purpose in a non-trivial application, so this method should be deprecated.If you really want to fetch an entire database table, then you should do that explicitly with a JPQL call in the context where this is needed.
The text was updated successfully, but these errors were encountered: