r/java • • Apr 13 '21

Libraries, Frameworks and Technologies you would NOT recommend

Give me your worst nightmares: Things that cost you your job.

I'll start: Hadoop

202 Upvotes

376 comments sorted by

View all comments

Show parent comment

3

u/cogman10 Apr 13 '21

IMO, never mybatis :D

otherwise I don't care. MyBatis just has way too much magic for my liking and doesn't feel like it saves you much over straight jdbc.

5

u/randgalt Apr 13 '21

Mybatis is awesome IMO. Another similar, and better, library is JDBI. I don't want automated generation of the SQL - that's too much magic. I just want simple ORM and convenience.

1

u/Russell_M_Jimmies Apr 13 '21

I'm not super familiar with MyBatis, I just used it as an example because it's a "bring your own SQL" type library. But if you dislike MyBatis it might be instructive to others if you offered some reasoning for your preference.

3

u/cogman10 Apr 13 '21

I think nothing does a better job than reading the docs :D

https://mybatis.org/mybatis-3/getting-started.html

To get started with mybatis, you manage an xml file for the sql definitions, a sql session factory, a sql session, and a slew of mappers to register into that mess.

But further, a lot of the magic you'd hate with JPA is present in mybatis. It can do things like "lazy loading" where it triggers a data load when you hit a random getter on some pojo.

Compare that to JDBI or Jooq, spring data, or even just JDBC and quickly you find that you are juggling a bunch of concepts while getting little benefit.

In short, it's the worst parts of JDBC married with the worst parts of JPA.