问题

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 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?

回答1:

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

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.

来源:https://stackoverflow.com/questions/61010482/oracle-jdbc-oracledatabaseexception-ora-00972-identifier-is-too-long

Logo

一站式 AI 云服务平台

更多推荐