oracle.jdbc.OracleDatabaseException: ORA-00972: 标识符太长 [英] oracle.jdbc.OracleDatabaseException: ORA-00972: identifier is too long

查看:34
本文介绍了oracle.jdbc.OracleDatabaseException: ORA-00972: 标识符太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的实体类

@Entity公共类项目详细信息{@ID私人 int projectId;私人字符串项目描述;私有 int 语言 ID;}@实体公共类项目{@ID私人 int projectId;私人字符串项目名称;私人本地日期项目开始日期;私人本地日期项目结束日期;私人字符串项目状态;@OneToOne私人项目详细信息项目详细信息;}

我有一个这样的 JPA 方法

ListfindProjectsByProjectsIdAndProjectDetailsLanguageId(int projectId, int languageId)

执行时出现以下错误.

oracle.jdbc.OracleDatabaseException: ORA-00972: 标识符太长

已添加Physical-statergy命名配置

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

我读过隐式策略,但不确定.知道如何解决这个问题吗?

解决方案

来自 2.8.1 数据库对象命名规则取自 Oracle DB 12.2 文档:

<块引用>

  1. 标识符名称的最大长度取决于 COMPATIBLE 初始化参数的值.

    • 如果 COMPATIBLE 设置为 12.2 或更高的值,则名称长度必须为 1 到 128 个字节,以下情况除外:

      • 数据库名称限制为 8 个字节.

      • 磁盘组、可插拔数据库 (PDB)、回滚段、表空间和表空间集的名称限制为 30 个字节.

对于这个版本,标识符太长了.唯一的方法是使用较短的名称或将 COMPATIBLE 降级到较低版本.

Here is my Entity class

@Entity
public class ProjectDetails {

    @Id
    private int projectId;
    private String projectDescription;
    private int languageId;


}


@Entity
public class Project {

    @Id
    private int projectId;
    private String projectName;
    private LocalDate projectStartDate;
    private LocalDate projectEndDate;
    private String projectStatus;

    @OneToOne
    private ProjectDetails projectDetails;


}

I have a JPA method like this

List<Projects> findProjectsByProjectsIdAndProjectDetailsLanguageId(int projectId, int languageId)

While executing I am getting below error.

oracle.jdbc.OracleDatabaseException: ORA-00972: identifier is too long

Already added Physical-statergy naming configuration

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

I read about implicit-strategy but not sure about it. Any idea how to solve the issue?

解决方案

From the 2.8.1 Database Object Naming Rules taken from the Oracle DB 12.2 documentation:

  1. The maximum length of identifier names depends on the value of the COMPATIBLE initialization parameter.

    • If COMPATIBLE is set to a value of 12.2 or higher, then names must be from 1 to 128 bytes long with these exceptions:

      • Names of databases are limited to 8 bytes.

      • Names of disk groups, pluggable databases (PDBs), rollback segments, tablespaces, and tablespace sets are limited to 30 bytes.

For this version, the identifier is simply too long. The only way to go is to either use a shorter name or downgrade COMPATIBLE to a lower version.

这篇关于oracle.jdbc.OracleDatabaseException: ORA-00972: 标识符太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆