1

I can't find any default implementation class for spring-data-commons crudrepository interface. We always implement CustomRepository extends CrudRepository<T, ID> and then @Autowire CustomRepository customRepository in the service class to call customRepository.save(s)..which always works.

I'd like to understand the low level details associated with any crudrepository method e.g. save(S);

  1. When is the connection to underlying database opened or closed?
  2. How the transaction boundaries are defined?
  3. How does it work with connection-pool?

    Any pointers to the right resources would be really helpful.Please feel free to point me out if I'm missing something silly...
Divs
  • 1,578
  • 2
  • 24
  • 51
  • 1
    The connection/session is, as with regular Spring code, opened when the transaction starts. Generally that is done with a `@Transactional` on the service level. When transaction finishes the session is closed and connection is also closed (with a connection pool this results in returning it to the pool). – M. Deinum Jul 24 '17 at 12:07
  • @M.Deinum Thanks! Will it be possible to guide me to the default implementation class? `SimpleJpaRepository` is default impl for `JpaRepository`... is there a default impl class for `CrudRepository` also? – Divs Jul 25 '17 at 10:36
  • The `SimpleJpaRepository` it is. – M. Deinum Jul 25 '17 at 10:41
  • @M.Deinum Thanks! So the default implementation of `CrudRepository` is JPA compliant and Hibernate is the default JPA Provider. – Divs Jul 26 '17 at 08:27

0 Answers0