I am working on a desktop application built using spring framework and one of the part of the application is not working. I found that the repository class does not have any queries with @Query annotation. I haven't encountered it before.
When I try to open the form that uses this, I get an error that the application is not able to connect to the database. The application has 3 databases specified in the application.properties. I have the following questions:
1) How does the following code work without a query specified with @Query annotation. Or where is the query written.
@Repository
public interface AccountRepository extends JpaRepository<Account, Long> {
List<Account> findAccountsByActiveIsTrueAndAccountTypeEquals(String accountType);
List<Account> findAccountsByAccountTypeLike(String type);
}
2) How do we specify which of the database to search for. For example: I have 3 mysql databases currently connected to my application. I wish to access data from DB1 through my Spring boot application through the usual flow of UI model-> BE Controller/ Service layer -> Repository(Interface) which (usually) has the query written with @Query. How we specify which database this query goes for ?