spring boot并调用存储过程注释或entityManager?

Posted

技术标签:

【中文标题】spring boot并调用存储过程注释或entityManager?【英文标题】:spring boot and call stored procedure annotations or entityManger? 【发布时间】:2020-02-08 19:59:38 【问题描述】:

有人可以帮我解决这个问题,告诉我调用存储过程的正确方法是什么?

1. I've seen annotations to call a procedure like : 
   @Procedure: In this case I have seen that they create the procedure in the entity,
   but I think it is not most optimal.
   @Query: I have been able to call my procedure with this option, but when I would like a
   parameter to be     null, I don't know how to do it since there is
   not much information. 
2. I've been using entityManager and I've been able to make a parameter null, but I don't know if it's 
   the best way to call a procedure with entityManager

另外,创建一个验证数据的过程是否很好?或者没有必要,无论是在真实情况下还是仅在后端有效

【问题讨论】:

【参考方案1】:

@NamedStoredProcedureQueries 是调用存储过程的更好选择

【讨论】:

以上是关于spring boot并调用存储过程注释或entityManager?的主要内容,如果未能解决你的问题,请参考以下文章

使用 Spring Boot 调用 BigQuery 存储过程(例程)

修复 Spring Boot 中存储过程之间的转换问题

使用 jparepository 调用存储过程 Spring Boot 应用程序

基于Spring Boot,使用JPA动态调用Sql查询数据

Spring Boot:在长时间运行的存储过程中检测到明显的连接泄漏

JSF 注释不适用于 Spring-boot