Here is a small example that: Uses @DataJpaTest annotation to bring in only configuration relevant for JPA tests (entities, repos etc...)Uses @TestMethodOrder(MethodOrderer.OrderAnnotation.class) and @Order annotations to enforce order of method executionUses @ComponentScan(basePackages = {"tech.dimitar.rosdjpaint.bootstrap"}) annotation to bring in the component that bootstraps the dataUses @Commit annotation on test to enforce transaction does not roll back … Continue reading Spring Boot JPA Test Splice
Month: May 2022
Spring Boot – Enable SQL logging
Enable sql logging, format and show bind parameters values, add to application.properties: # spring.jpa.show-sql=true # Show SQL spring.jpa.properties.hibernate.show_sql = true # Format SQL spring.jpa.properties.hibernate.format_sql=true # Show bind values! logging.level.org.hibernate.type.descriptor.sql=trace Example output (insert): Hibernate: call next value for hibernate_sequence Hibernate: insert into book (isbn, publisher, title, id) values (?, ?, ?, ?) 2022-05-17 19:57:10.916 TRACE 44505 … Continue reading Spring Boot – Enable SQL logging