【问题标题】:jdbctemplate query() vs entityManager createQuery()jdbctemplate query() 与 entityManager createQuery()
【发布时间】:2010-05-11 08:53:17
【问题描述】:

这些方法的本质区别是什么?

query() 的 JdbcTemplate 和 createQuery() 的 EntityManager?

据我了解,两者都执行查询?

【问题讨论】:

    标签: dao entitymanager jdbctemplate


    【解决方案1】:

    JdbcTemplate.query() 通过 Spring 的 JDBC API 执行原始 SQL 查询

    EntityManager.createQuery() 通过本机 JPA API 创建但不执行 JPA 查询。

    相同的最终结果,非常不同的机制。

    【讨论】:

    • 谢谢,我问这个问题是因为在 Spring 项目中使用 EntityManager 表达式时对我来说很奇怪。
    猜你喜欢
    • 1970-01-01
    • 2012-04-12
    • 2016-05-02
    • 1970-01-01
    • 2013-03-20
    • 2011-03-08
    • 1970-01-01
    • 1970-01-01
    • 2021-12-14
    相关资源
    最近更新 更多