Problems with generating sql via eclipseLink - missing separator

后端 未结 3 1167
悲&欢浪女
悲&欢浪女 2021-01-11 19:26

i\'am using eclipseLink with jpa. in my persistence.xml, i defined to generate a create.sql file. the file will be generated, but with missing \';\'-separators for each sql

相关标签:
3条回答
  • 2021-01-11 19:51

    If it's a one off, replace every "\n\n" with ";\n\n". Wouldn't recommend this as a permanent solution though...

    0 讨论(0)
  • 2021-01-11 19:58

    I encountered this problem and solved it by setting a property in persistence.xml.

    Since Eclipselink 2.6, there is a property "eclipselink.ddlgen-terminate-statements" that when set to true, a delimiter will be appended to each statement.

    I think I was using H2 database at that time.

    For more details, see http://www.eclipse.org/eclipselink/api/2.6/org/eclipse/persistence/config/PersistenceUnitProperties.html

    0 讨论(0)
  • 2021-01-11 20:06

    The token used to separate the statements depends on the DatabasePlatform being used. I assume you are using Oracle, as from the code it seems to be the only one that does not use a separator, although I'm not sure why.

    What tool are you using the execute the script? Seems like a bug that ";" is not being used for Oracle, please log this bu in EclipseLink and vote for it.

    To workaround the issue create your own OraclePlatform subclass and override,

    getStoredProcedureTerminationToken() {
      return ";"
    }
    

    (please include in the bug that a different method should be used for DDL, not the StoredProcedureTerminationToken.

    You can set your platform using the "eclipselink.target-database" property.

    0 讨论(0)
提交回复
热议问题