Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put a comment into HQL (Hibernate Query Language)?

Is it possible to put comments into Hibernate Query Language? If so, how?

like image 237
Thomas Bratt Avatar asked Jul 07 '10 16:07

Thomas Bratt


1 Answers

Make sure your session is configured with:


<property name="hibernate.use_sql_comments">true</property>

Then do:


Query query = ...;
query.setComment("Some comment here");

and you will see something like the following in your MySQL log file (if you're using MySQL):


5998 Query /* Some comment here */ select .....

like image 118
Hisham Avatar answered Sep 23 '22 02:09

Hisham