1

I use Spring Data Repository

@Repository
public interface SomeRepository extends CrudRepository<Some, Long> {

}

And I have some jdbs methods for Some entity. Big select with joins and etc. I implement it by NamedParameterJdbcTemplate

And I have 2 point for get data from DB:

  1. SomeRepository
  2. SomeDAO(with native query, big selects)

How can I combine it?

I have 2 ways:

  1. SomeService inject SomeRepository and SomeDAO
  2. SomeDAO inject SomeRepository and have own methods and wrapp SomeRepository methods for CRUD
user5620472
  • 2,722
  • 8
  • 44
  • 97
  • For example I have very hard and big native query – user5620472 Sep 06 '17 at 08:00
  • I know this annotation and use it. my question is not on this. There are tasks that do not solve this way. And also I will need to use the special language of the database language – user5620472 Sep 06 '17 at 08:06
  • Why not create a custom repository extension ? See : https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#repositories.custom-implementations (I recently did this for an elasticsearch repository, but the same apply whatever the data store : https://stackoverflow.com/questions/39790434/how-to-query-elastic-with-spring-data-elastic/39793107#39793107) – GPI Sep 06 '17 at 08:28

0 Answers0