glassfish
  1. glassfish
  2. GLASSFISH-20651

EclipseLink Generates DDL Statements Without Trailing Semicolon

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0_b89_RC5
    • Fix Version/s: None
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      All

      Description

      EclipseLink generates DDL statements (CREATE TABLE, DROP Table etc.) without the trailing semicolon. The statements are so no directly usable in a CI enviromnent.

      Expected:

      CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME));

      is

      CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))

      Seems like all target databases are effected.

        Activity

        abien created issue -
        Hide
        guypelletier added a comment -

        EclipseLink currently does not generate platform dependent terminators in DDL generation. It does however have the capability to do so and it could be achieve through a new property setting.

        Can you please enter an EclipseLink bug to include this functionality?

        Show
        guypelletier added a comment - EclipseLink currently does not generate platform dependent terminators in DDL generation. It does however have the capability to do so and it could be achieve through a new property setting. Can you please enter an EclipseLink bug to include this functionality?
        Hide
        alexeev_net added a comment -

        I traced the problem down to the field createSQLFiles in the class SchemaManager:

        org.eclipse.persistence.tools.schemaframework.SchemaManager
         
          protected boolean createSQLFiles = true; //if true, schema writer will add terminator string.
        

        In order to generate platform dependent terminators in DDL generation, this field shall be true. Unfortunately, EntityManagerFactoryProvider explicitly turns this flag to false:

        org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider
         
          protected static void writeDDLsToFiles(SchemaManager mgr,  String appLocation, String createDDLJdbc, String dropDDLJdbc) {
            //..
            mgr.setCreateSQLFiles(false); // BUG!
            //..
        

        As a result, every DDL statement in SQL-File is terminated with "\n" instead of platform dependent terminator.

        To me it seems like there is a trivial bugfix for EntityManagerFactoryProvider, replacing mgr.setCreateSQLFiles(false) by mgr.setCreateSQLFiles(true).
        I already tested it locally with EL 2.3.2 and EL 2.4.2.

        Show
        alexeev_net added a comment - I traced the problem down to the field createSQLFiles in the class SchemaManager : org.eclipse.persistence.tools.schemaframework.SchemaManager protected boolean createSQLFiles = true ; // if true , schema writer will add terminator string. In order to generate platform dependent terminators in DDL generation, this field shall be true . Unfortunately, EntityManagerFactoryProvider explicitly turns this flag to false : org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider protected static void writeDDLsToFiles(SchemaManager mgr, String appLocation, String createDDLJdbc, String dropDDLJdbc) { //.. mgr.setCreateSQLFiles( false ); // BUG! //.. As a result, every DDL statement in SQL-File is terminated with "\n" instead of platform dependent terminator. To me it seems like there is a trivial bugfix for EntityManagerFactoryProvider, replacing mgr.setCreateSQLFiles(false) by mgr.setCreateSQLFiles(true) . I already tested it locally with EL 2.3.2 and EL 2.4.2.
        Hide
        Alessandro Brandimarti added a comment -
        Show
        Alessandro Brandimarti added a comment - EclipseLink bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=438871

          People

          • Assignee:
            Mitesh Meswani
            Reporter:
            abien
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: