You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comparison of usage of non-JPA SQL mapping frameworks for Java (Jooq, Spring JDBCTemplate etc.).
3
4
4
5
We are not comparing performance (that'll be maybe added later), but rather how are these frameworks used for everyday tasks.
@@ -15,39 +16,36 @@ We tried to find optimal (== most readable) implementation in every framework, b
15
16
## Scenarios implemented
16
17
17
18
These are the scenarios:
19
+
18
20
1. Fetch single entity based on primary key
19
21
2. Fetch list of entities based on condition
20
22
3. Save new single entity and return primary key
21
23
4. Batch insert multiple entities of same type and return generated keys
22
24
5. Update single existing entity - update all fields of entity at once
23
-
6. Fetch entity and it's many-to-one relation (Company for Department)
24
-
7. Fetch entity and it's one-to-many relation (Departments for Company)
25
-
8. Update entities one-to-many relation - add two items, update two items and delete one item
25
+
6. Fetch many-to-one relation (Company for Department)
26
+
7. Fetch one-to-many relation (Departments for Company)
27
+
8. Update entities one-to-many relation (Departments in Company) - add two items, update two items and delete one item - all at once
26
28
9. Complex select - construct select where conditions based on some boolean conditions + throw in some joins
27
29
10. Call stored procedure/function and process results
28
30
11. Execute query using JDBC simple Statement (not PreparedStatement)
29
31
30
-
See javadoc of [Scenarios](src/main/java/com/clevergang/dbtests/Scenarios.java)class for description of each scenario.
32
+
Each scenario has it's implementation in the Scenarios class. See javadoc of [Scenarios](src/main/java/com/clevergang/dbtests/Scenarios.java)methods for more detailed description of each scenario.
31
33
32
34
## Model used
33
35
34
36

35
37
36
38
## Why only non-JPA?
37
-
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
38
-
(Hibernate mostly), we realized it's counterproductive. In most of our projects it caused more problems than
39
-
it helped to solve - especially in big projects (with lots of tables and relations).
40
-
There are many reasons of those failures - but the biggest issue is that JPA implementations simply turned into bloatware.
41
-
Lot of strange magic is happening inside and the complexity is so high, that you need a high-class Hibernate uberexpert
42
-
in every team so the app actually shows some performance and the code is manageable...
43
-
44
-
So we dropped JPA completely, started using JDBCTemplate and discovered that we can deliver apps sooner
45
-
(which was kind of surprising), they are a lot faster (thanks to effective use of DB) and much more robust...
46
-
This was really relaxing and we do not plan to return to JPA at all... (yes, even for CRUD applications!)
47
-
48
-
This project aims to explore other options in the SQL mapping area than just JDBCTemplate. It should serve us
39
+
40
+
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...
41
+
42
+
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!)
43
+
44
+
This project aims to explore other options in the SQL mapping area than just JDBCTemplate. It should serve us
45
+
49
46
- as point of reference when deciding for SQL mapping framework
50
47
- as a template of common DB usage scenarios
51
48
- to document best practices of such common usages (**comments are welcomed!**)
52
49
53
-
Use code in the repository as you like (MIT License)
50
+
51
+
**Use code in the repository as you like (MIT License)**
0 commit comments