Community
Participate
Working Groups
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.
Created attachment 206314 [details] Java error for @ManyToOne
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.
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
Verified in build 20111110