1

I am starting with a new project and currently evaluating whether to use JPA or JDBC. Our operations mostly are going to be an bulk-insert and bulk-read and very rarely single insert/read. I checked a prototype with JPA and JDBC and realized that both has its own merits and limitations. Considering the current use case that for a fact I will only have always a bulk read and bulk write, which one will be a better option to go with ?

Spring JPA Repository gives a simple method save(Collection) which can take a collection and save as well.

Also Validations are also not be considered here, as the payload will already be validated in the layers above and the database layer should just do the read/write operations.

Does the JPA save(Collection<>) method in turn uses the jdbc templates or is it entirely a different implementation ?

Thanks in advance !

Neil Stockton
  • 11,383
  • 3
  • 34
  • 29
Avis
  • 53
  • 1
  • 7
  • 1
    Possible duplicate of [JPA or JDBC, how are they different?](http://stackoverflow.com/questions/11881548/jpa-or-jdbc-how-are-they-different) – user7036414 Nov 29 '16 at 09:43
  • I wouldn't say it's just a duplicate. This question also asks if the JPA uses JDBC API or not. – Turbut Alin Nov 29 '16 at 09:47

1 Answers1

1

We use both JPA and JDBC in one application wiht no problem. Preferably we use JPA/JPQL and fall back to JDBC if needed. For JPA we use Spring Data JPA and for JDBC Spring JDBC Template.

Robert Niestroj
  • 15,299
  • 14
  • 76
  • 119
  • I don't think the question is whether JPA and JDBCTemplates can be used together in one project. Of course they can. The questions seems to be rather about the memory consumption and the performance in the case that the dominant operation is a bulk insert. Actually I think JDBC Templates are cheaper. – Gregor Nov 30 '16 at 07:24