I'm about in 1 year developing systems in Java using JPA as database framework.
Every time I query, I do not close the EntityManager, IMO understanding is that JPA automatically closes EntityManager after executing the query like
getSingleResult() or getResultList()
If not then does garbage collection will collect it to dispose?