Skip to content

Commit f1827fb

Browse files
author
bretislav.wajtr
committed
#6 Speedment implementation - actually tried to implement but framework rejected for reasons described in README.md
1 parent 5580d2b commit f1827fb

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

README.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Java persistence frameworks comparison
22

3-
Comparison of usage of **non-JPA** SQL mapping (persistence) frameworks for Java (Jooq, Spring JDBCTemplate, MyBatis etc.).
3+
Comparison of how **non-JPA** SQL mapping (persistence) frameworks for Java (Jooq, Spring JDBCTemplate, etc.) are used.
44

5-
We are not comparing performance, but rather how are these frameworks used for everyday tasks.
5+
I'm not comparing performance, but rather how are these frameworks used for everyday tasks.
66

7-
We prepared some common scenarios, which you typically need to implement data-centric application, and then we implemented these scenarios using various non-JPA DB layer frameworks. This project should serve
7+
I prepared some common scenarios, which you typically need to implement data-centric application, and then we implemented these scenarios using various non-JPA DB layer frameworks. This project should serve
88
- as point of reference when deciding for SQL mapping framework
99
- as a template of common framework usage scenarios (see scenarios below)
1010
- to document best practices of such common usages (**comments are welcomed!**)
@@ -13,11 +13,21 @@ We prepared some common scenarios, which you typically need to implement data-ce
1313

1414
## Frameworks compared
1515

16-
* Spring JDBCTemplate (see [implementation](src/main/java/com/clevergang/dbtests/repository/impl/jdbctemplate/JDBCDataRepositoryImpl.java))
17-
* jOOQ (see [implementation](src/main/java/com/clevergang/dbtests/repository/impl/jooq/JooqDataRepositoryImpl.java))
18-
* MyBatis (see [implementation](src/main/java/com/clevergang/dbtests/repository/impl/mybatis/MyBatisDataRepositoryImpl.java) and [mapper](src/main/resources/mybatis/mappers/DataRepositoryMapper.xml))
16+
I have following (subjectively evaluated :)) conditions on frameworks which I choose for consideration:
17+
1. The framework should embrace - not hide - SQL language and RDBMS we are using
18+
2. The framework must be mature enough for "enterprise level" use.
19+
3. Can utilize JPA annotations, but must not be full JPA implementation (see "Why only non-JPA?" section below)
1920

20-
We tried to find optimal (== most readable) implementation in every framework, but comments are welcomed! There are lot of comments explaining why we chose to such implementation and some FIXMEs on places which we do not like, but which cannot be implemented differently or which we have troubles to improve...
21+
With that conditions in respect, following frameworks were compared:
22+
23+
* **Spring JDBCTemplate** (see [implementation](src/main/java/com/clevergang/dbtests/repository/impl/jdbctemplate/JDBCDataRepositoryImpl.java))
24+
* **jOOQ** (see [implementation](src/main/java/com/clevergang/dbtests/repository/impl/jooq/JooqDataRepositoryImpl.java))
25+
* **MyBatis** (see [implementation](src/main/java/com/clevergang/dbtests/repository/impl/mybatis/MyBatisDataRepositoryImpl.java) and [mapper](src/main/resources/mybatis/mappers/DataRepositoryMapper.xml))
26+
27+
I tried to find optimal (== most readable) implementation in every framework, but comments are welcomed! There are lot of comments in the code explaining why I chose such implementation and some FIXMEs on places which I do not like, but which cannot be implemented differently or which I have troubles to improve...
28+
29+
Furthermore, I considered (and tried to implement) even following frameworks, but it turned out they do not meet the conditions:
30+
* [Speedment](https://github.com/speedment/speedment) - hides SQL language too much and tries to replace with stream operations; not all scenarios can be implemented in it; as of 11/30/2016 and version 3.0.1 the documentation on GitHub is very weak
2131

2232
## Scenarios implemented
2333

@@ -51,17 +61,15 @@ Each scenario has it's implementation in the Scenarios class. See javadoc of [Sc
5161

5262
## Why only non-JPA?
5363

54-
Well, we were trying to "stick with standard" in our projects so we used JPA in the past, but after many years of JPA usage (Hibernate mostly), we realized it's counterproductive. In most of our projects it caused more problems than it helped to solve - especially in big projects (with lots of tables and relations). There are many reasons of those failures - but the biggest issue is that JPA implementations simply turned into bloatware. Lot of strange magic is happening inside and the complexity is so high, that you need a high-class Hibernate uberexpert in every team so the app actually shows some performance and the code is manageable...
64+
Well, me and my colleagues were always trying to "stick with standard" in our projects so we used JPA in the past, but after many years of JPA usage (Hibernate mostly), we realized it's counterproductive. In most of our projects it caused more problems than it helped to solve - especially in big projects (with lots of tables and relations). There are many reasons of those failures - but the biggest issue is that JPA implementations simply turned into bloatware. Lot of strange magic is happening inside and the complexity is so high, that you need a high-class Hibernate uberexpert in every team so the app actually shows some performance and the code is manageable...
5565

5666
So we dropped JPA completely, started using JDBCTemplate and discovered that we can deliver apps sooner (which was kind of surprising), they are a lot faster (thanks to effective use of DB) and much more robust... This was really relaxing and we do not plan to return to JPA at all... (yes, even for CRUD applications!)
5767

5868
This project aims to explore other options in the SQL mapping area than just JDBCTemplate.
5969

6070
## Conclusions/Notes
6171

62-
I was able to implement all of the scenarios with all of the tested frameworks -
63-
with only difference in how comfortable or inconvenient it was. Please note that following remarks
64-
are very subjective and does not have to necessarily apply to you.
72+
Please note that following remarks are very subjective and does not have to necessarily apply to you.
6573

6674
#### What would I choose
6775

0 commit comments

Comments
 (0)