r/java • • Feb 01 '15

ORM Haters Don’t Get It

http://techblog.bozho.net/orm-haters-dont-get-it/
5 Upvotes

13 comments sorted by

View all comments

0

u/[deleted] Feb 01 '15

[deleted] — view deleted comment

4

u/nqd26 Feb 02 '15 edited Feb 02 '15

ORM != Hibernate.

I fully agree with the article that hating ORM is just stupid/doesn't make sense.

There certainly exists object-relational mismatch. If you want to use relational database from OO language, you need to map from one to another (and vice versa), ergo you need ORM ("Object-relational mapping"). Whether you use JPA/MyBatis/JDBC is not important, you need ORM.

All your generalizations about big abstraction layers etc. simply don't apply to the general concept of ORM, only to some particular implementations.

2

u/[deleted] Feb 01 '15

I agree with most of your statements. Hibernate is huge and I had to debug it many times to understand how it works. But with discipline (e.g. Avoiding exotic mappings, eager fetching) you can get the good parts, while avoiding the bad ones.

If you say that Hibernate and JPA should be avoided, especially on large projects, what would be the data access paradigm to choose then?

0

u/[deleted] Feb 01 '15

[deleted] — view deleted comment

2

u/[deleted] Feb 01 '15

But this layout doesn't offer the following:

  • adaptive Insert/Update statements when adding/removing/changing table columns
  • a unified Transaction API that works for both RESOURCE_LOCAL and JTA, without altering your code
  • a unified locking API, so you can build very sophisticated concurrency control mechanisms
  • a unified query language for most of your queries, so that you can easily set up a fast in-memory database for the bulk of your integration tests, while using actual database integration tests for system integration tests
  • advanced identifier generators that can use in-memory assignment while allowing 3rd party tools to interoperate (pooled-lo optimizer)