4 ms·
I try to avoid it as much as possible. It's confusing at least to me and makes maintaining code over a long haul an arduous dull process. I'm getting to the poi
by jebblue 12y ago
I try to avoid it as much as possible. It's confusing at least to me and makes maintaining code over a long haul an arduous dull process. I'm getting to the point where I prefer straight JDBC over Hibernate too. It takes longer to code but I've seen speed increases of several times over Hibernate in those situations. JDBC code is just linear but I feel it's easier to maintain in the long run.
- edwinnathaniel 12y agoSpeed is not the only concern when it comes to JDBC vs ORM (JPA/Hibernate). The more complex the data model, the more one needs to know the inner working of JPA. I've shared my struggle understanding how JPA works even for a medium-level complexity of the JPA entities. Some of the problems I've encountered using JPA: - The whole EntityManager act as L1 cache occasionally tripped me when writing Integration-Tests - The relationship direction (owning, etc) can be confusing to learn - Reference vs Lazy vs Eager load Having said that, HBM2DDL is a nice tool that can work as maven plugin such that changes on the JPA entities can resulted the DDL to be updated properly thus maintaining consistency between Java Data Model and the DB schema.
- JustSomeNobody 12y agoThankfully I am seeing more and more comments like this. I really think we off the deep end with all this. Simple is key.
- EdwardDiego 12y agoI agree. Hibernate has become a downright liability at times in our codebase. These days I only use it in new code for query parameterization and result row transforms into models. Speaking of which, if anyone knows of a good library for query parameterization alone, let me know...
- ZitchDog 12y agoJDBI is quite good: http://jdbi.org/ http://jdbi.org/
- EdwardDiego 12y agoCheers mate! That createQuery() call looks to be exactly what I need (query safety on a low level JDBC stream object).
- allengeorge 12y agoA second shoutout for JDBI. I don't attempt to use it for anything fancy, but it hides a lot of the JDBI boilerplate in a very sane way.
- umut 12y agoWe use JDBI @Truecaller together with Metrics library. Not only it is clean and tidy, it also gives you immediate profiling around your database calls. This is priceless in a big service oriented environment. With it, you can exactly see the rate of happening (mean/last 1/5/15 minutes average) and latency (mean/avg/std-dev/75/95/98/99/99,9percentiles) for each database query. I wouldn't want to go back to manual logging and optimization hell. JDBI+Metrics opens a totally new dimension to your monitoring/profiling/optimization!
- mushishi 12y agoCheckout Dalesbred, http://dalesbred.evident.fi/ http://dalesbred.evident.fi/ It's our in-house jdbc library, and has IDEA plugin. We use it in many small projects, and in one major.
- penrod 12y agoThis might be of interest to you: https://github.com/gilesjb/copalis.sql https://github.com/gilesjb/copalis.sql
- pjmlp 12y agoBack in 2007 we had a developer pissing one architect as he replaced a few J2EE 1.3 entity beans by pure JDBC calls. The modified code ran in a fraction of the time the pure architecture was running.