2
I have a simple requisition GET
for example, to search a product for your ID
:
@Autowired
private ProdutoRepository produtos;
@GetMapping
public Optional<Produto> listarProduto(){
return produtos.findById(1L);
}
Is there any property that would allow me to see the number of queries made in a request?
I searched for properties I could put in my file application.properties
and I just found some:
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
among other properties that did not help me in the case. I am beginner in the subject and I am studying on, I also tried to see if Postman (where I test the requests) would have some configuration that would help me in that sense, but without success.
Query number is relative, because a query can call a subquery, in which case you would count as one or two? What is your goal?
– Cayo Souza
@Cayosouza, at first only the most outsiders. I’m a beginner in the subject and I’m studying how to map my entities and how they behave in operations. Sometimes with the log properties I found it was not clear if I am applying the concepts 100% correctly, especially when I try to work with a table with many records in the database (the n+1 problem of JPA, Lazy and Eager loading, Pagging, among others) for example.
– Lucas Lemos