0

I'm developing a Spring boot project in IntelliJ. I have enabled reload changed classes and are currently working on the JPA queries.

Data is in my database via inserts in the data.sql file.

Starting and stopping the server after changing a query is very slow, it is also a bit cumbersome to update the SQL to find it fails, or I need INSERTS and UPDATES to create correctly referenced foreign keys.

A sample JPA query, for example:

@Query("SELECT m FROM MechanicVisit m WHERE m.id = :id")
Optional <MechanicVisit> getOneManually(@Param("id") Long id);

I have read the manual about Spring tests and ask if the testing framework within Spring boot would allow for testing of these JPA queries without rebooting the server and even setting up the minimal test data.

Q What is the fastest way to test these queries?

Ray Bond
  • 427
  • 3
  • 11
  • Can be duplicate of https://stackoverflow.com/questions/23435937/how-to-test-spring-data-repositories – Mina- Jun 22 '23 at 02:30

0 Answers0