[hibernate-dev] Dialect support for SQL comments.
Daniel Bell
daniel.bell at nec.com.au
Mon May 4 21:48:11 EDT 2009
Chris,
I created a JIRA for this with a patch on 7/Jul/8. See HHH-3379.
Thanks,
Daniel.
On Mon, 2009-05-04 at 16:22 -0400, Chris Bredesen wrote:
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20090505/f46dfb4c/attachment.html
More information about the hibernate-dev
mailing list