The comment syntax /* */ fails on DB2 for z/OS
-----------------------------------------------
Key: HHH-3004
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3004
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: Hibernate version 3.2.5
DB2 for z/OS version 8.2
Reporter: Steen Klingenberg
Priority: Minor
if the property use_sql_comments is set to true comments with the syntax /* */ issued in
Hibernate SQL statements causes DB2 to fail because the syntax is NOT supported when
connecting from a Java application...
From the DB2 manual - source: DB2 SQL Reference v8 zOS
Comments in SQL statements: SQL statements can include host language comments or SQL
comments. Either type of comment can be specified wherever a space is valid, except within
a delimiter token or between the keywords EXEC and SQL. The following rules apply to SQL
comments:
- The two hyphens must be on the same line, not separated by a space.
- Comments cannot be continued on the next line.
- Within a statement embedded in a COBOL program, the two hyphens must be preceded by a
blank unless they begin a line.
- In Java, SQL comments are not allowed within embedded Java expressions.
For "host languages", however, comments following the syntax /* */ are allowed!
Host languages include COBOL, C, Rexx... but not Java!
Would it perhaps be possible to externalize the Java statements creating the comment
String into the Dialect class hierarchy ?
e.g. modifying (in InsertSelect):
buf.append( "/* " ).append( comment ).append( " */ " );
It requires the comments to be single-lined though - at least for DB2. Otherwise it
doesn't follow above rules!
Having only experience from the combination Hibernate and DB2 for z/OS and no SQL embedded
comments I cannot tell the benefit potential.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira