Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORA-00972 when creating the Javers schema in Oracle 12c #388

Closed
obigard opened this issue Jun 14, 2016 · 8 comments
Closed

ORA-00972 when creating the Javers schema in Oracle 12c #388

obigard opened this issue Jun 14, 2016 · 8 comments
Labels

Comments

@obigard
Copy link
Contributor

@obigard obigard commented Jun 14, 2016

Hello,

I'm trying to use Javers with Oracle 12c.
When building the Javers object, here is the Exception I have:

2016-06-14 22:31:46,399 [main] INFO org.javers.repository.sql.schema.JaversSchemaManager - creating javers table jv_commit ...
2016-06-14 22:31:46,400 [main] INFO org.polyjdbc.core.schema.SchemaManagerImpl - creating entity with name jv_commit using ddl:\nCREATE TABLE jv_commit (\ncommit_pk NUMBER NOT NULL,\nauthor VARCHAR2(200),\ncommit_date TIMESTAMP,\ncommit_id NUMBER(12,2),\nCONSTRAINT jv_commit_pk PRIMARY KEY(commit_pk)\n)
2016-06-14 22:31:46,487 [main] INFO org.polyjdbc.core.schema.SchemaManagerImpl - creating entity with name jv_commit_commit_id_idx using ddl:\nCREATE INDEX jv_commit_commit_id_idx ON jv_commit(commit_id)
2016-06-14 22:31:46,493 [main] INFO org.polyjdbc.core.schema.SchemaManagerImpl - creating entity with name jv_commit_pk_seq using ddl:\nCREATE SEQUENCE jv_commit_pk_seq
2016-06-14 22:31:46,503 [main] INFO org.javers.repository.sql.schema.JaversSchemaManager - creating javers table jv_commit_property ...
2016-06-14 22:31:46,503 [main] INFO org.polyjdbc.core.schema.SchemaManagerImpl - creating entity with name jv_commit_property using ddl:\nCREATE TABLE jv_commit_property (\nproperty_name VARCHAR2(200),\nproperty_value VARCHAR2(200),\ncommit_fk NUMBER,\nCONSTRAINT jv_commit_property_pk PRIMARY KEY(commit_fk, property_name),\nCONSTRAINT jv_commit_property_commit_fk FOREIGN KEY(commit_fk) REFERENCES jv_commit(commit_pk)\n)
2016-06-14 22:31:46,513 [main] INFO org.polyjdbc.core.schema.SchemaManagerImpl - creating entity with name jv_commit_property_commit_fk_idx using ddl:\nCREATE INDEX jv_commit_property_commit_fk_idx ON jv_commit_property(commit_fk)

org.polyjdbc.core.exception.SchemaManagerException: [DDL_ERROR] Failed to run DDL:
CREATE INDEX jv_commit_property_commit_fk_idx ON jv_commit_property(commit_fk)
at org.polyjdbc.core.schema.SchemaManagerImpl.ddl(SchemaManagerImpl.java:91)
at org.polyjdbc.core.schema.SchemaManagerImpl.create(SchemaManagerImpl.java:52)
at org.javers.repository.sql.schema.JaversSchemaManager.ensureTable(JaversSchemaManager.java:222)
at org.javers.repository.sql.schema.JaversSchemaManager.ensureSchema(JaversSchemaManager.java:41)
at org.javers.repository.sql.JaversSqlRepository.ensureSchema(JaversSqlRepository.java:80)
at org.javers.core.JaversBuilder.build(JaversBuilder.java:105)
at com.axway.tnt.audit.impl.AuditServiceTest.testJavers(AuditServiceTest.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$ContainerAwareMethodInvoker.invokeMethod(CdiTestRunner.java:341)
at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$ContainerAwareMethodInvoker.evaluate(CdiTestRunner.java:313)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner.runChild(CdiTestRunner.java:175)
at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner.runChild(CdiTestRunner.java:76)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$BeforeClassStatement.evaluate(CdiTestRunner.java:367)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$AfterClassStatement.evaluate(CdiTestRunner.java:393)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner.run(CdiTestRunner.java:142)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)

Caused by: java.sql.SQLSyntaxErrorException: ORA-00972: l'identificateur est trop long
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:195)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1036)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1916)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1878)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:318)
at org.polyjdbc.core.schema.SchemaManagerImpl.ddl(SchemaManagerImpl.java:88)
... 38 more

It seems the index name is larger than 30 characters, which is not allowed by Oracle...

Thanks

@obigard
Copy link
Contributor Author

@obigard obigard commented Jun 15, 2016

Any idea/suggestion so that I can propose a PR?

Thanks

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Jun 15, 2016

Its hard to believe that modern database doesn't support names longer than 30 chars... We have tested JaVers with Oracle latest version and everything seemed fine. Is this problem specific to this concrete Oracle version?

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Jun 15, 2016

Ok, looks like all Oracle version have this limit, even latest 12x.
https://community.oracle.com/ideas/3338
Shame for Oracle 👎

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Jun 15, 2016

fix should be done in FixedSchemaFactory.columnIndex()
if dialect == Oracle than substring(indexName,30)

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Jun 15, 2016

are you going to contribute a PR?

@obigard
Copy link
Contributor Author

@obigard obigard commented Jun 16, 2016

Of course, I'll try!

@obigard
Copy link
Contributor Author

@obigard obigard commented Jun 16, 2016

PR done!

bartoszwalacik added a commit that referenced this issue Jun 16, 2016
bartoszwalacik added a commit that referenced this issue Jun 16, 2016
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Jun 17, 2016

fix released in 2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.