I am using JBoss Development Studio Version: 8.0.0.Beta1 that comes with
| Dali Java Persistence Tools - JPA Support |
3.4.0.v201401221940-7V7dEpFC7sReAYthMgWBL39c7 |
When I try to generate entities from tables I get erros associated with contraints that
shouldnt´s be happening.
It seems to be a problem with JPA or Dali. I attached the database structure to this post
to make it easier to try to reproduce the problem if anyone wishes to.
the Platform is Hibernate(JPA 2.1)
I have 3 erros written below.
Any ideas of how to fix this wierd behaviour?
*Error #01*
{code:jivemacro_uid=_14056960246948738|class=jive_text_macro jive_macro_code
_jivemacro_uid_14056960246948738}
org.apache.velocity.exception.MethodInvocationException: Invocation of method
'getImportStatements' in class org.eclipse.jpt.jpa.gen.internal.ORMGenTable threw
exception java.lang.IllegalStateException:
aluno_x_disciplina.FK_IDDISCIPLINA_ALUNODISCIPLINA - mismatched sizes: 1 vs. 2 @
main.java.vm[7,9]
at
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:205)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:294)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.Template.merge(Template.java:254)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:508)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:473)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateJavaFile(PackageGenerator.java:333)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateClass(PackageGenerator.java:310)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateInternal(PackageGenerator.java:132)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.doGenerate(PackageGenerator.java:106)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generate(PackageGenerator.java:82)
at
org.eclipse.jpt.jpa.ui.internal.wizards.gen.GenerateEntitiesFromSchemaWizard$GenerateEntitiesJob.runInWorkspace(GenerateEntitiesFromSchemaWizard.java:285)
at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.IllegalStateException:
aluno_x_disciplina.FK_IDDISCIPLINA_ALUNODISCIPLINA - mismatched sizes: 1 vs. 2
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.buildColumnPairArray(DTPForeignKeyWrapper.java:116)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.getColumnPairArray(DTPForeignKeyWrapper.java:106)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.getLocalColumnPairs(DTPForeignKeyWrapper.java:101)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.getBaseColumns(DTPForeignKeyWrapper.java:146)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.baseColumnsContains(DTPForeignKeyWrapper.java:150)
at
org.eclipse.jpt.jpa.db.internal.DTPTableWrapper.foreignKeyBaseColumnsContains(DTPTableWrapper.java:216)
at
org.eclipse.jpt.jpa.db.internal.DTPColumnWrapper.isPartOfForeignKey(DTPColumnWrapper.java:58)
at org.eclipse.jpt.jpa.gen.internal.ORMGenColumn.isForeignKey(ORMGenColumn.java:266)
at
org.eclipse.jpt.jpa.gen.internal.ORMGenTable.buildColumnTypesMap(ORMGenTable.java:206)
at
org.eclipse.jpt.jpa.gen.internal.ORMGenTable.getImportStatements(ORMGenTable.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:137)
at
org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:350)
at
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:180)
... 14 more
{code}
*Error #02*
{code:jivemacro_uid=_14056960332731901|class=jive_text_macro jive_macro_code
_jivemacro_uid_14056960332731901}
org.apache.velocity.exception.MethodInvocationException: Invocation of method
'isDefault' in class org.eclipse.jpt.jpa.gen.internal.ORMGenColumn threw
exception java.lang.IllegalStateException: disciplina_x_prereq.FK_DISCIPLINA_DISCPREREQ -
mismatched sizes: 1 vs. 2 @ column.vm[21,16]
at
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:205)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTReference.java:396)
at org.apache.velocity.runtime.parser.node.ASTNotNode.evaluate(ASTNotNode.java:64)
at org.apache.velocity.runtime.parser.node.ASTOrNode.evaluate(ASTOrNode.java:99)
at
org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExpression.java:64)
at
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:86)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.directive.Parse.render(Parse.java:224)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:448)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.Template.merge(Template.java:254)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:508)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:473)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateJavaFile(PackageGenerator.java:333)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateClass(PackageGenerator.java:314)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateInternal(PackageGenerator.java:132)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.doGenerate(PackageGenerator.java:106)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generate(PackageGenerator.java:82)
at
org.eclipse.jpt.jpa.ui.internal.wizards.gen.GenerateEntitiesFromSchemaWizard$GenerateEntitiesJob.runInWorkspace(GenerateEntitiesFromSchemaWizard.java:285)
at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.IllegalStateException: disciplina_x_prereq.FK_DISCIPLINA_DISCPREREQ -
mismatched sizes: 1 vs. 2
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.buildColumnPairArray(DTPForeignKeyWrapper.java:116)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.getColumnPairArray(DTPForeignKeyWrapper.java:106)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.getLocalColumnPairs(DTPForeignKeyWrapper.java:101)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.getBaseColumns(DTPForeignKeyWrapper.java:146)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.baseColumnsContains(DTPForeignKeyWrapper.java:150)
at
org.eclipse.jpt.jpa.db.internal.DTPTableWrapper.foreignKeyBaseColumnsContains(DTPTableWrapper.java:216)
at
org.eclipse.jpt.jpa.db.internal.DTPColumnWrapper.isPartOfForeignKey(DTPColumnWrapper.java:58)
at org.eclipse.jpt.jpa.gen.internal.ORMGenColumn.isForeignKey(ORMGenColumn.java:266)
at org.eclipse.jpt.jpa.gen.internal.ORMGenColumn.isUpdateable(ORMGenColumn.java:373)
at org.eclipse.jpt.jpa.gen.internal.ORMGenColumn.isDefault(ORMGenColumn.java:128)
at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:137)
at
org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:350)
at
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:180)
... 26 more
{code}
*Error #03*
{code:jivemacro_uid=_14056960466417767|class=jive_text_macro jive_macro_code
_jivemacro_uid_14056960466417767}
org.apache.velocity.exception.MethodInvocationException: Invocation of method
'getImportStatements' in class org.eclipse.jpt.jpa.gen.internal.ORMGenTable threw
exception java.lang.IllegalStateException: disciplinasoferecidas.FK_DISCOFF_DISC -
mismatched sizes: 1 vs. 2 @ main.java.vm[7,9]
at
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:205)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:294)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.Template.merge(Template.java:254)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:508)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:473)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateJavaFile(PackageGenerator.java:333)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateClass(PackageGenerator.java:310)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateInternal(PackageGenerator.java:132)
at
org.eclipse.jpt.jpa.gen.internal.PackageGenerator.doGenerate(PackageGenerator.java:106)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generate(PackageGenerator.java:82)
at
org.eclipse.jpt.jpa.ui.internal.wizards.gen.GenerateEntitiesFromSchemaWizard$GenerateEntitiesJob.runInWorkspace(GenerateEntitiesFromSchemaWizard.java:285)
at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.IllegalStateException: disciplinasoferecidas.FK_DISCOFF_DISC -
mismatched sizes: 1 vs. 2
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.buildColumnPairArray(DTPForeignKeyWrapper.java:116)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.getColumnPairArray(DTPForeignKeyWrapper.java:106)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.getLocalColumnPairs(DTPForeignKeyWrapper.java:101)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.getBaseColumns(DTPForeignKeyWrapper.java:146)
at
org.eclipse.jpt.jpa.db.internal.DTPForeignKeyWrapper.baseColumnsContains(DTPForeignKeyWrapper.java:150)
at
org.eclipse.jpt.jpa.db.internal.DTPTableWrapper.foreignKeyBaseColumnsContains(DTPTableWrapper.java:216)
at
org.eclipse.jpt.jpa.db.internal.DTPColumnWrapper.isPartOfForeignKey(DTPColumnWrapper.java:58)
at org.eclipse.jpt.jpa.gen.internal.ORMGenColumn.isForeignKey(ORMGenColumn.java:266)
at
org.eclipse.jpt.jpa.gen.internal.ORMGenTable.buildColumnTypesMap(ORMGenTable.java:206)
at
org.eclipse.jpt.jpa.gen.internal.ORMGenTable.getImportStatements(ORMGenTable.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:137)
at
org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:350)
at
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:180)
... 14 more
{code}
Posted by forums
Original post:
https://community.jboss.org/message/881680#881680