7

几个流行ORM 框架的性能测试(Oracle JMH),大家怎么看?

 3 years ago
source link: https://www.oschina.net/question/4657953_2320643
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

几个流行ORM 框架的性能测试(Oracle JMH),大家怎么看?

ObjectiveSql 发布于 昨天 12:35
阅读 191

perf

ObjectiveSQL-1.4.5    MyBatis-3.5.6   Hibernate-5.2.12

详细测试代码(benchmark):https://github.com/braisdom/ObjectiveSql

查询代码:

// ObjectiveSQL
User.queryByPrimaryKey(1);

// MyBatis
SqlSession session = sqlSessionFactory.openSession();
try {
    UserMapper mapper = session.getMapper(UserMapper.class);
    return mapper.getUserById(1);
} finally {
    session.close();
}

// Hibernate
Session session = sessionFactory.openSession();
Query<User> query = session.createQuery("from com.github.braisdom.objsql.benchmark.User " +
        "user where user.id = 1");
User user = query.getSingleResult();
session.close();

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK