Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 291233

Summary: Exceptions when generating entities from certain Sybase tables
Product: [WebTools] Dali JPA Tools Reporter: Leonard Theivendra <theivend>
Component: GeneralAssignee: Danny Ju <danny.ju>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: brian.vosburgh, neil.hauge, zhang
Version: unspecified   
Target Milestone: 2.3 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
DDL file to create Sybase tables none

Description Leonard Theivendra CLA 2009-10-02 13:34:30 EDT
User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Build Identifier: WTP 3.2

For a certain Sybase schema and set of tables, the generation of entities fails with "Unable to find JPA entities generation templates in plugin org.eclipse.jpt.gen" exceptions, and not all entities are generated. The same set of tables in DB2 don't show these problems.

Reproducible: Always

Steps to Reproduce:
1. Create a connection to a Sybase 15.0 database (jconn3.jar jdbc driver) and create the tables in the default schema using the attached SYBASE_SurveyBTMUP.sql DDL file.

2. Create a JPA project configured to use this connection and launch the entity generation wizard, choose the SURVEY, QUESTION, CHOICE, and RESULT tables and finish the wizard

3. Only a partial set of entities are created and with various validation errors like:

Description	Resource	Path	Location	Type
Choice cannot be resolved to a type	Question.java	/TestJPAProj/src	line 22	Java Problem
Result cannot be resolved to a type	Question.java	/TestJPAProj/src	line 73	Java Problem
Syntax error on token "SURVEY_NAME", / expected	Question.java	/TestJPAProj/src	line 26	Java Problem
Syntax error on token "SURVEY_NAME", / expected	QuestionPK.java	/TestJPAProj/src	line 16	Java Problem
In implied attribute override "_surveyName_", column "" cannot be resolved	Question.java	/TestJPAProj/src	line 15	Validation Message
Join column "" cannot be resolved	Question.java	/TestJPAProj/src	line 26	Validation Message
Target entity "Choice" for "choices" is not an Entity	Question.java	/TestJPAProj/src	line 21	Validation Message
Target entity "Result" for "results" is not an Entity	Question.java	/TestJPAProj/src	line 30	Validation Message

And these exceptions are logged:

org.eclipse.core.runtime.CoreException: Unable to find JPA entities generation templates in pluginorg.eclipse.jpt.gen
	at org.eclipse.jpt.gen.internal.PackageGenerator2.generateClass(PackageGenerator2.java:202)
	at org.eclipse.jpt.gen.internal.PackageGenerator2.generateInternal(PackageGenerator2.java:112)
	at org.eclipse.jpt.gen.internal.PackageGenerator2.doGenerate(PackageGenerator2.java:92)
	at org.eclipse.jpt.gen.internal.PackageGenerator2.generate(PackageGenerator2.java:73)
	at org.eclipse.jpt.ui.internal.wizards.gen.GenerateEntitiesFromSchemaWizard$GenerateEntitiesJob.runInWorkspace(GenerateEntitiesFromSchemaWizard.java:252)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getReferencedColumn' in  class org.eclipse.jpt.gen.internal.AssociationRole threw exception java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 @ join.vm[69,33]
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:286)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
	at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:419)
	at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:73)
	at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:125)
	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.ASTBlock.render(ASTBlock.java:74)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
	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.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.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.gen.internal.PackageGenerator2.generateJavaFile(PackageGenerator2.java:215)
	at org.eclipse.jpt.gen.internal.PackageGenerator2.generateClass(PackageGenerator2.java:191)
	... 6 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
	at java.util.ArrayList.get(ArrayList.java:338)
	at org.eclipse.jpt.gen.internal.AssociationRole.getReferencedColumn(AssociationRole.java:117)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:599)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:295)
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
	... 38 more
Comment 1 Leonard Theivendra CLA 2009-10-02 13:35:45 EDT
Created attachment 148666 [details]
DDL file to create Sybase tables
Comment 2 Leonard Theivendra CLA 2009-10-02 13:37:29 EDT
Dali plugin versions in this particular buid:

org.eclipse.jpt.branding_3.0.0.v200909220000.jar
org.eclipse.jpt.core_2.3.0.v200909190000.jar
org.eclipse.jpt.db.ui_1.1.100.v200906070220.jar
org.eclipse.jpt.db_1.2.200.v200909190000.jar
org.eclipse.jpt.doc.isv_1.2.0.v200906050220.jar
org.eclipse.jpt.doc.user_1.2.0.v200908250000.jar
org.eclipse.jpt.gen_1.3.100.v200909190000.jar
org.eclipse.jpt.ui_2.3.0.v200909190000.jar
org.eclipse.jpt.utility_1.5.0.v200909190000.jar
Comment 3 Neil Hauge CLA 2009-10-02 14:59:58 EDT
Most likely a DTP issue.  We'll take a look and confirm.
Comment 4 Neil Hauge CLA 2009-11-20 16:20:57 EST
Danny...are you able to test on Sybase?
Comment 5 Allan Zhang CLA 2010-03-29 12:29:34 EDT
I'm having the same problem, wondering you have an update on this?
Comment 6 Neil Hauge CLA 2010-03-30 11:33:44 EDT
No update yet...will look at this soon.
Comment 7 Brian Vosburgh CLA 2010-04-15 19:43:39 EDT
I am unable to re-create this bug. I created the tables and generated the entities without any exceptions (although I did encounter the problem described in bug 309403). Are you using the base Dali configuration, with the base DTP drivers? Or are you using a custom DTP driver to access Sybase?

Since I cannot re-create the exception, I can only remark that we have had similar problems in the past when the underlying DTP driver does not correctly return metadata about foreign keys.
Comment 8 Danny Ju CLA 2010-04-20 18:56:35 EDT
Not reproduced for me either. Close for now.