java.sql.SQLException: [CONTRACT1]Incorrect syntax near the keyword 'Order'.

Hibernate JIRA | acha114 | 1 decade ago
  1. 0

    This was requested by Christian in the Hibernate forums, see http://forum.hibernate.org/viewtopic.php?p=2222021#2222021 for the post. Chapter 5.3 of the Hibernate reference, "SQL quoted identifiers" is a bit vague in handling of reserved words for platforms. It says that the backtick character should be used for table names and field names. The backtick works for field names but not tables. I'll illustrate with a few examples. E.g. Using SQL Server I have a reserved word called freeText. In my mapping file, I can handle this in two ways. Using a backtick <property name="freeText" column="`freeText`"/> Using a square bracket <property name="freeText" column="[freeText]"/> Both are fine E.g. Using Oracle, I have a reserved word called comment. In my mapping file, I can handle this in two ways Using a backtick <property name="comment" column="`COMMENT`"/> Using single quotes outside the double quote <property name="comment" column='"COMMENT"'/> The doco does not say that Oracle requires the reserved word to be in upper case, however Oracle gurus probably know this. E.g. Using Oracle and SQL Server, I have a reserved word called Order, and this is a table. Backtick does not work, so I use the following as a workaround Using SQL Server - Use square brackets to enclose table name <class name="com.orchestral.cdr.element.Order" table="[Order]"> Using Oracle - Use single quotes to enclose double quotes around upper case table name <class name="com.orchestral.cdr.element.Order" table='"ORDER"'> An example of the exception stack trace explains that the SQL is too ambigious for Hibernate to interpret even though I use the backtick symbol, e.g. If I use the backtick symbol for a table like so: <class name="com.orchestral.cdr.element.Order" table="`Order`"> <class name="com.orchestral.cdr.element.Order" table="`ORDER`"> it produces the trace net.sf.hibernate.JDBCException: Could not save object at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:783) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:890) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:951) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at com.orchestral.cdr.CDRDBBaseImpl.persist(CDRDBBaseImpl.java:287) at com.orchestral.cdr.element.PersistReportTest.testPersistReport(PersistReportTest.java:69) at java.lang.reflect.Method.invoke(Native Method) at junit.framework.TestCase.runTest(TestCase.java:166) at junit.framework.TestCase.runBare(TestCase.java:140) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:131) at junit.framework.TestSuite.runTest(TestSuite.java:173) at junit.framework.TestSuite.run(TestSuite.java:168) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186) Caused by: java.sql.SQLException: [CONTRACT1]Incorrect syntax near the keyword 'Order'. at com.inet.tds.e.a(Unknown Source) at com.inet.tds.e.a(Unknown Source) at com.inet.tds.b.int(Unknown Source) at com.inet.tds.b.executeQuery(Unknown Source) at net.sf.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:67) at net.sf.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:42) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) ... 33 more Putting Show SQL to true gives this [DEBUG] (hibernate.impl.SessionImpl ) - generated identifier: 1 [DEBUG] (hibernate.impl.SessionImpl ) - saving [com.orchestral.cdr.element.Report#1] [DEBUG] (hibernate.engine.Cascades ) - processing cascades for: com.orchestral.cdr.element.Report [DEBUG] (hibernate.engine.Cascades ) - cascading to saveOrUpdate() [DEBUG] (hibernate.impl.SessionImpl ) - saveOrUpdate() unsaved instance [DEBUG] (hibernate.id.IncrementGenerator ) - fetching initial value: select max(id) from Order [DEBUG] (ibernate.util.JDBCExceptionReporter) - SQL Exception java.sql.SQLException: [CONTRACT1]Incorrect syntax near the keyword 'Order'. at com.inet.tds.e.a(Unknown Source) at com.inet.tds.e.a(Unknown Source) at com.inet.tds.b.int(Unknown Source) at com.inet.tds.b.executeQuery(Unknown Source) at net.sf.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:67) at net.sf.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:42) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:890) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:951) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at com.orchestral.cdr.CDRDBBaseImpl.persist(CDRDBBaseImpl.java:287) at com.orchestral.cdr.element.PersistReportTest.testPersistMultipleReports(PersistReportTest.java:106) at java.lang.reflect.Method.invoke(Native Method) at junit.framework.TestCase.runTest(TestCase.java:166) at junit.framework.TestCase.runBare(TestCase.java:140) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:131) at junit.framework.TestSuite.runTest(TestSuite.java:173) at junit.framework.TestSuite.run(TestSuite.java:168) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186) [ WARN] (ibernate.util.JDBCExceptionReporter) - SQL Error: 156, SQLState: 01000 [ERROR] (ibernate.util.JDBCExceptionReporter) - [CONTRACT1]Incorrect syntax near the keyword 'Order'. [ERROR] (ibernate.util.JDBCExceptionReporter) - Could not save object java.sql.SQLException: [CONTRACT1]Incorrect syntax near the keyword 'Order'. at com.inet.tds.e.a(Unknown Source) at com.inet.tds.e.a(Unknown Source) at com.inet.tds.b.int(Unknown Source) at com.inet.tds.b.executeQuery(Unknown Source) at net.sf.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:67) at net.sf.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:42) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:890) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:951) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at com.orchestral.cdr.CDRDBBaseImpl.persist(CDRDBBaseImpl.java:287) at com.orchestral.cdr.element.PersistReportTest.testPersistMultipleReports(PersistReportTest.java:106) at java.lang.reflect.Method.invoke(Native Method) at junit.framework.TestCase.runTest(TestCase.java:166) at junit.framework.TestCase.runBare(TestCase.java:140) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:131) at junit.framework.TestSuite.runTest(TestSuite.java:173) at junit.framework.TestSuite.run(TestSuite.java:168) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186) Is this an issue to be looked at? Make the backtick work for tables just like it is for fieldnames. Or update the documentation to be more specific on this area.

    Hibernate JIRA | 1 decade ago | acha114
    java.sql.SQLException: [CONTRACT1]Incorrect syntax near the keyword 'Order'.
  2. 0

    This was requested by Christian in the Hibernate forums, see http://forum.hibernate.org/viewtopic.php?p=2222021#2222021 for the post. Chapter 5.3 of the Hibernate reference, "SQL quoted identifiers" is a bit vague in handling of reserved words for platforms. It says that the backtick character should be used for table names and field names. The backtick works for field names but not tables. I'll illustrate with a few examples. E.g. Using SQL Server I have a reserved word called freeText. In my mapping file, I can handle this in two ways. Using a backtick <property name="freeText" column="`freeText`"/> Using a square bracket <property name="freeText" column="[freeText]"/> Both are fine E.g. Using Oracle, I have a reserved word called comment. In my mapping file, I can handle this in two ways Using a backtick <property name="comment" column="`COMMENT`"/> Using single quotes outside the double quote <property name="comment" column='"COMMENT"'/> The doco does not say that Oracle requires the reserved word to be in upper case, however Oracle gurus probably know this. E.g. Using Oracle and SQL Server, I have a reserved word called Order, and this is a table. Backtick does not work, so I use the following as a workaround Using SQL Server - Use square brackets to enclose table name <class name="com.orchestral.cdr.element.Order" table="[Order]"> Using Oracle - Use single quotes to enclose double quotes around upper case table name <class name="com.orchestral.cdr.element.Order" table='"ORDER"'> An example of the exception stack trace explains that the SQL is too ambigious for Hibernate to interpret even though I use the backtick symbol, e.g. If I use the backtick symbol for a table like so: <class name="com.orchestral.cdr.element.Order" table="`Order`"> <class name="com.orchestral.cdr.element.Order" table="`ORDER`"> it produces the trace net.sf.hibernate.JDBCException: Could not save object at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:783) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:890) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:951) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at com.orchestral.cdr.CDRDBBaseImpl.persist(CDRDBBaseImpl.java:287) at com.orchestral.cdr.element.PersistReportTest.testPersistReport(PersistReportTest.java:69) at java.lang.reflect.Method.invoke(Native Method) at junit.framework.TestCase.runTest(TestCase.java:166) at junit.framework.TestCase.runBare(TestCase.java:140) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:131) at junit.framework.TestSuite.runTest(TestSuite.java:173) at junit.framework.TestSuite.run(TestSuite.java:168) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186) Caused by: java.sql.SQLException: [CONTRACT1]Incorrect syntax near the keyword 'Order'. at com.inet.tds.e.a(Unknown Source) at com.inet.tds.e.a(Unknown Source) at com.inet.tds.b.int(Unknown Source) at com.inet.tds.b.executeQuery(Unknown Source) at net.sf.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:67) at net.sf.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:42) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) ... 33 more Putting Show SQL to true gives this [DEBUG] (hibernate.impl.SessionImpl ) - generated identifier: 1 [DEBUG] (hibernate.impl.SessionImpl ) - saving [com.orchestral.cdr.element.Report#1] [DEBUG] (hibernate.engine.Cascades ) - processing cascades for: com.orchestral.cdr.element.Report [DEBUG] (hibernate.engine.Cascades ) - cascading to saveOrUpdate() [DEBUG] (hibernate.impl.SessionImpl ) - saveOrUpdate() unsaved instance [DEBUG] (hibernate.id.IncrementGenerator ) - fetching initial value: select max(id) from Order [DEBUG] (ibernate.util.JDBCExceptionReporter) - SQL Exception java.sql.SQLException: [CONTRACT1]Incorrect syntax near the keyword 'Order'. at com.inet.tds.e.a(Unknown Source) at com.inet.tds.e.a(Unknown Source) at com.inet.tds.b.int(Unknown Source) at com.inet.tds.b.executeQuery(Unknown Source) at net.sf.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:67) at net.sf.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:42) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:890) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:951) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at com.orchestral.cdr.CDRDBBaseImpl.persist(CDRDBBaseImpl.java:287) at com.orchestral.cdr.element.PersistReportTest.testPersistMultipleReports(PersistReportTest.java:106) at java.lang.reflect.Method.invoke(Native Method) at junit.framework.TestCase.runTest(TestCase.java:166) at junit.framework.TestCase.runBare(TestCase.java:140) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:131) at junit.framework.TestSuite.runTest(TestSuite.java:173) at junit.framework.TestSuite.run(TestSuite.java:168) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186) [ WARN] (ibernate.util.JDBCExceptionReporter) - SQL Error: 156, SQLState: 01000 [ERROR] (ibernate.util.JDBCExceptionReporter) - [CONTRACT1]Incorrect syntax near the keyword 'Order'. [ERROR] (ibernate.util.JDBCExceptionReporter) - Could not save object java.sql.SQLException: [CONTRACT1]Incorrect syntax near the keyword 'Order'. at com.inet.tds.e.a(Unknown Source) at com.inet.tds.e.a(Unknown Source) at com.inet.tds.b.int(Unknown Source) at com.inet.tds.b.executeQuery(Unknown Source) at net.sf.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:67) at net.sf.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:42) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:890) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:951) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at com.orchestral.cdr.CDRDBBaseImpl.persist(CDRDBBaseImpl.java:287) at com.orchestral.cdr.element.PersistReportTest.testPersistMultipleReports(PersistReportTest.java:106) at java.lang.reflect.Method.invoke(Native Method) at junit.framework.TestCase.runTest(TestCase.java:166) at junit.framework.TestCase.runBare(TestCase.java:140) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:131) at junit.framework.TestSuite.runTest(TestSuite.java:173) at junit.framework.TestSuite.run(TestSuite.java:168) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186) Is this an issue to be looked at? Make the backtick work for tables just like it is for fieldnames. Or update the documentation to be more specific on this area.

    Hibernate JIRA | 1 decade ago | acha114
    java.sql.SQLException: [CONTRACT1]Incorrect syntax near the keyword 'Order'.
  3. 0

    Unable to bind the table in SQL Server2000 using com.inet.tds.TdsDriver

    Oracle Community | 1 decade ago | 666705
    java.sql.SQLException: [DPD30W34A]Invalid object name 'EmployeeInformation'.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Solved : JTDS MSSQL Pagination problem. (JDBC and Relational Databases forum at Coderanch)

    coderanch.com | 5 months ago
    java.sql.SQLException: Incorrect syntax near the keyword 'ORDER'.
  6. 0

    persistent session and MS SQL Server

    Google Groups | 2 decades ago | Patrick Clarebout
    java.sql.SQLException: [GUDRUNSQL]Incorrect syntax near the keyword 'for'.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.sql.SQLException

      [CONTRACT1]Incorrect syntax near the keyword 'Order'.

      at com.inet.tds.e.a()
    2. com.inet.tds
      b.executeQuery
      1. com.inet.tds.e.a(Unknown Source)
      2. com.inet.tds.e.a(Unknown Source)
      3. com.inet.tds.b.int(Unknown Source)
      4. com.inet.tds.b.executeQuery(Unknown Source)
      4 frames
    3. net.sf.hibernate
      SessionImpl.save
      1. net.sf.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:67)
      2. net.sf.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:42)
      3. net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765)
      4. net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
      5. net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387)
      6. net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
      7. net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
      8. net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
      9. net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:890)
      10. net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
      11. net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779)
      12. net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
      13. net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387)
      14. net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
      15. net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
      16. net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)
      17. net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
      18. net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
      19. net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:951)
      20. net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
      21. net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779)
      22. net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
      22 frames
    4. com.orchestral.cdr
      PersistReportTest.testPersistMultipleReports
      1. com.orchestral.cdr.CDRDBBaseImpl.persist(CDRDBBaseImpl.java:287)
      2. com.orchestral.cdr.element.PersistReportTest.testPersistMultipleReports(PersistReportTest.java:106)
      2 frames
    5. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      1 frame
    6. JUnit
      TestSuite.run
      1. junit.framework.TestCase.runTest(TestCase.java:166)
      2. junit.framework.TestCase.runBare(TestCase.java:140)
      3. junit.framework.TestResult$1.protect(TestResult.java:106)
      4. junit.framework.TestResult.runProtected(TestResult.java:124)
      5. junit.framework.TestResult.run(TestResult.java:109)
      6. junit.framework.TestCase.run(TestCase.java:131)
      7. junit.framework.TestSuite.runTest(TestSuite.java:173)
      8. junit.framework.TestSuite.run(TestSuite.java:168)
      8 frames
    7. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
      3 frames