Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2876

running 'refresh' schema action creates wrong SQL output

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.2.1
    • Component/s: sql
    • Labels:
      None

      Description

      Seems we trashed the SQL refresh feature along the way to JPA-2.0.

      I have a sample with an Entity 'Customer' with just an ID. Then I add a column OTHER_NAME and generate the result with sqlAction=refresh

      In OpenJPA-2.4.3 we get the following output:

      ALTER TABLE CUSTOMER ADD COLUMN OTHER_NAME VARCHAR(255);
      

      In OpenJPA-3.0.0 onwards we get this:

      ALTER TABLE CUSTOMER ADD COLUMN OTHER_NAME VARCHAR(255);
      CREATE TABLE CUSTOMER (ID BIGINT NOT NULL, active VARCHAR(1), OTHER_NAME VARCHAR(255), specialCustomer VARCHAR(1) NOT NULL, PRIMARY KEY (ID));
      CREATE TABLE OPENJPA_SEQUENCE_TABLE (ID TINYINT NOT NULL, SEQUENCE_VALUE BIGINT, PRIMARY KEY (ID));
      CREATE TABLE PUBLIC.CUSTOMER (ID BIGINT, ACTIVE VARCHAR(1), NAME VARCHAR(255), SPECIALCUSTOMER VARCHAR(1));
      

      It seems like we do not only run the MappingAction 'refresh' but also a 'build' plus we do it also without Schema and with the current Schema (PUBLIC).

        Attachments

          Activity

            People

            • Assignee:
              struberg Mark Struberg
              Reporter:
              struberg Mark Struberg
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: