EntityManagerFactoryUtils.java 文件源码

java
阅读 38 收藏 0 点赞 0 评论 0

项目:lams 作者:
/**
 * Prepare a transaction on the given EntityManager, if possible.
 * @param em the EntityManager to prepare
 * @param emf the EntityManagerFactory that the EntityManager has been created with
 * @return an arbitrary object that holds transaction data, if any
 * (to be passed into cleanupTransaction)
 * @see JpaDialect#prepareTransaction
 */
private static Object prepareTransaction(EntityManager em, EntityManagerFactory emf) {
    if (emf instanceof EntityManagerFactoryInfo) {
        EntityManagerFactoryInfo emfInfo = (EntityManagerFactoryInfo) emf;
        JpaDialect jpaDialect = emfInfo.getJpaDialect();
        if (jpaDialect != null) {
            return jpaDialect.prepareTransaction(em,
                    TransactionSynchronizationManager.isCurrentTransactionReadOnly(),
                    TransactionSynchronizationManager.getCurrentTransactionName());
        }
    }
    return null;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号