[hibernate-dev] Dialect support for SQL comments.
Chris Bredesen
cbredesen at redhat.com
Mon May 4 16:22:35 EDT 2009
Daniel,
Thanks for the work on this. You should file a JIRA and include your
patch there so it can be considered for inclusion.
Cheers,
Chris
Daniel Bell wrote:
> Hi,
>
> 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.
>
> I have included a complete patch for this change for hibernate 3.2.6.GA.
> Please consider its inclusion in Hibernate.
>
> Thanks,
> Daniel.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
More information about the hibernate-dev
mailing list