@Test
public void testFunction() {
try {
doInJPA(entityManager -> {
StoredProcedureQuery query = entityManager.createStoredProcedureQuery("fn_count_comments");
query.registerStoredProcedureParameter("postId", Long.class, ParameterMode.IN);
query.setParameter("postId", 1L);
Long commentCount = (Long) query.getSingleResult();
assertEquals(Long.valueOf(2), commentCount);
});
} catch (Exception e) {
assertTrue(Pattern.compile("PROCEDURE high_performance_java_persistence.fn_count_comments does not exist").matcher(e.getCause().getCause().getMessage()).matches());
}
}
MySQLStoredProcedureTest.java 文件源码
java
阅读 46
收藏 0
点赞 0
评论 0
项目:high-performance-java-persistence
作者:
评论列表
文章目录