[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3379) Dialect support for SQL comments

Daniel Bell (JIRA) noreply at atlassian.com
Mon Jul 7 19:14:38 EDT 2008


Dialect support for SQL comments
--------------------------------

                 Key: HHH-3379
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3379
             Project: Hibernate3
          Issue Type: Patch
    Affects Versions: 3.2.6
         Environment: Hibernate 3.2.6.ga, Informix 7.31
            Reporter: Daniel Bell
         Attachments: hibernate.dialect.patch

I have recently tried turning on SQL comments in hibernate 3.2.6.ga.
However, I found that our database (informix 7.31) did not support SQL
where the comment was at the start of the comment. Instead, the comment
needed to be after the SQL. For example:

/* not accepted by informix 7.31*/ select * from systables;

select * from systables /* accepted by informix 7.31*/

Because of this, I have added a method to the Dialect for adding comments:

   /**
    * Add a comment to the SQL string.
    *
    * @param sql          StringBuffer holding the SQL.
    * @param comment      Comment to add to the SQL. May be null.
    */
   public void addCommentToSql(StringBuffer sql, String comment) {
       if (StringHelper.isNotEmpty(comment))
           sql.insert(0, "/* " + comment + " */ ");
   }

Thus, the default implementation provides the same functionality as
before. However, derived Dialects may override this method to add the
comment in a different location.

It is also possible to add additional comments in the derived Dialect.
In our case, we also add the Java thread ID. 

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list