Spring-Boot 3升级后无法找到javax.persistence.NamedStoredProcedureQuery

drkbr07n  于 2023-02-28  发布在  Spring
关注(0)|答案(1)|浏览(194)

我将Sping Boot Starter Parent从2.7升级到了3.0.2。

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.0.2</version>
</parent>

此代码在实体对象上使用了一些存储过程注解,但已找不到这些注解:

import javax.persistence.NamedStoredProcedureQueries;
import javax.persistence.NamedStoredProcedureQuery;
import javax.persistence.ParameterMode;
import javax.persistence.StoredProcedureParameter;
...

@Entity
@Table(name = "some_table")
@NamedStoredProcedureQueries({
    @NamedStoredProcedureQuery(name = "updateproctime", procedureName = "SP1", parameters = {
            @StoredProcedureParameter(mode = ParameterMode.IN, type = String.class, name = "p_form_name"),
            @StoredProcedureParameter(mode = ParameterMode.IN, type = String.class, name = "p_office_code"),
            @StoredProcedureParameter(mode = ParameterMode.IN, type = String.class, name = "p_form_type"),
            @StoredProcedureParameter(mode = ParameterMode.IN, type = Date.class, name = "p_processing_date"),
            @StoredProcedureParameter(mode = ParameterMode.IN, type = Date.class, name = "p_effctve_dt")
            })})
public class SomeEntity implements Serializable {
   //...
}

有什么建议吗?

pqwbnv8z

pqwbnv8z1#

Sping Boot 3发行版转而使用Jakarta持久性API而不是javax.persistence.api
https://mvnrepository.com/artifact/jakarta.persistence/jakarta.persistence-api
添加该依赖项并将import javax.persistence.*;更改为import jakarta.persistence.*;

相关问题