[JAVA] Write what you thought after using mybatis for half a year

What is mybatis?

It is a kind of OR mapper for Java and has the following features.

It's been half a year since I used it in the project I'm in charge of, so I'll write down the good points and issues.

good point

The class used for SQL access is reduced

For JDBC

For mybatis

Can write SQL in XML

When assembling SQL in Java

StringBuffer sql = new StringBuffer();
sql.append("select * from table ");
sql.append("where id=? ");
sql.toString();

For Mybatis Mapper XML

<select id="selectPerson" parameterType="int" resultType="hashmap">
  SELECT * FROM PERSON WHERE ID = #{id}
</select>

SQL is completely separated from logic (Java file)

Bad point

Since it is XML, the refactoring function of eclipse cannot be used.

Since it is XML, coverage cannot be obtained.

Summary

Recommended Posts

Write what you thought after using mybatis for half a year
What I pointed out as a reviewer for half a year
Awareness of object-oriented programming for half a year
What was good for a fledgling engineer who started programming for a year and a half, and what I thought I should have done
What do you need after all to create a web application using java? Explain the mechanism and what is necessary for learning
[Note] What I learned in half a year from inexperienced (Java)
[Note] What I learned in half a year from inexperienced (Java) (1)
[Note] What I learned in half a year from inexperienced (Java) (3)