javaspringspring-bootspring-mvcjparepository

How add multiple entity class in single JPARepository in springboot application


@Repository public interface ticketsDao extends JpaRepository<owners, Object>

For every entity class, I need to create the Dao. How I use multiple entity class in single Dao.


Solution

  • It is not possible as you can only query on one entity and there can be only one Entity for a repository

    You can use Joins in your queries if you want to query from other tables. However, with JpaRepository you can only extend with one at a time.