Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362637 - @ManyToOne, etc. should have egl compiling error in EDT version 0.7
Summary: @ManyToOne, etc. should have egl compiling error in EDT version 0.7
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-02 03:59 EDT by Thomas Wu CLA
Modified: 2017-02-23 14:20 EST (History)
3 users (show)

See Also:


Attachments
Java error for @ManyToOne (164.84 KB, image/pjpeg)
2011-11-02 04:02 EDT, Thomas Wu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wu CLA 2011-11-02 03:59:23 EDT
Build Identifier: 20111101

Refered to bug 355573, I am tring to use the annotations, such as @ManyToOne, which are not supported in EDT0.7. There is no egl compiling error, but there is error in generated java code. So I suggest add some egl errors for them to prevent uers' adopting. 

Reproducible: Always

Steps to Reproduce:
1.Create the following records using Derby connection. Then add a ManyToOne association.
record CUSTOMER type Entity{@table{name = "EGL.CUSTOMER"}}
    CUSTOMER_ID int{@id};
    FIRST_NAME string?;
    LAST_NAME string?;
    PASSWORD string?;
    PHONE string?;
    EMAIL_ADDRESS string?;
    STREET string?;
    APARTMENT string?;
    CITY string?;
    STATE string?;
    POSTALCODE string?;
    DIRECTIONS string?;
end

record ORDERS type Entity{@table{name = "EGL.ORDERS"}}
    ORDER_ID int{@id};
    CUSTOMER_ID int?;
    ORDER_AMOUNT decimal(8, 2)?;
    ORDER_DETAILS string?;
    ORDER_DATE date?;
    ORDER_STATUS string?;
    customer CUSTOMER {@ManyToOne};
end

2.Add the following function to get records from ORDERS table.
program testsql type BasicProgram {}
	
	ds SQLDataSource = new SQLDataSource("jdbc:derby:C:/databases/EGLDerbyR7;create=true");
	customer CUSTOMER;
	order ORDERS;
	
	function main()
		testGet();
	end
	
	function testGet()
			
		get order from ds using(order.ORDER_ID) with
			#sql{
				select
					ORDER_ID, CUSTOMER_ID, ORDER_AMOUNT, 
					rtrim(ORDER_DETAILS), ORDER_DATE, rtrim(ORDER_STATUS)
				from EGL.ORDERS
				where
					(t1.customer=t1.ORDER_ID and t1.ORDER_ID=?)
			};
	end
end

Actual results: There is no egl error reporting, but there is an error in generated Java code. Please refer to screenshots.
Comment 1 Thomas Wu CLA 2011-11-02 04:02:15 EDT
Created attachment 206314 [details]
Java error for @ManyToOne
Comment 2 Justin Spadea CLA 2011-11-07 12:11:42 EST
Those unsupported annotations are simply ignored and not causing the problem. I don't think we need to add restrictive validation unless they do cause a problem. If you delete the annotation you still get the same compile error.
Comment 3 Joseph Vincens CLA 2011-11-09 22:43:23 EST
Paul removed the associations from the language so ManyToOne will be an error. 
I fixed generation so complex types like CUSTOMER will not create a generation compile error.


Changed:
org.eclipse.edt.gen.java.templates.eglx.persistence/src/org/eclipse/edt/gen/java/templates/eglx/persistence/sql/SqlAddStatementTemplate.java

org.eclipse.edt.gen.java.templates.eglx.persistence/src/org/eclipse/edt/gen/java/templates/eglx/persistence/sql/SqlReplaceStatementTemplate.java

org.eclipse.edt.gen.java.templates.eglx.persistence/src/org/eclipse/edt/gen/java/templates/eglx/persistence/sql/SqlOpenStatementTemplate.java

org.eclipse.edt.gen.java.templates.eglx.persistence/src/org/eclipse/edt/gen/java/templates/eglx/persistence/sql/SqlActionStatementTemplate.java

org.eclipse.edt.gen.java.templates.eglx.persistence/src/org/eclipse/edt/gen/java/templates/eglx/persistence/sql/SqlGetByKeyStatementTemplate.java

org.eclipse.edt.runtime.java/src/org/eclipse/edt/javart/util/DateTimeUtil.java

org.eclipse.edt.mof.eglx.persistence.sql/src/org/eclipse/edt/mof/eglx/persistence/sql/utils/SQL.java
Comment 4 Thomas Wu CLA 2011-11-10 22:25:46 EST
Verified in build 20111110