File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
main/java/org/hibernate/engine/jdbc/internal
test/java/org/hibernate/orm/test/sql/hand/query Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -69,8 +69,16 @@ public String perform() {
6969
7070 while ( tokens .hasMoreTokens () ) {
7171 token = tokens .nextToken ();
72- lcToken = token .toLowerCase (Locale .ROOT );
7372
73+ if ( "-" .equals (token ) && result .toString ().endsWith ("-" ) ) {
74+ do {
75+ result .append ( token );
76+ token = tokens .nextToken ();
77+ }
78+ while ( !"\n " .equals ( token ) && tokens .hasMoreTokens () );
79+ }
80+
81+ lcToken = token .toLowerCase (Locale .ROOT );
7482 switch (lcToken ) {
7583
7684 case "'" :
Original file line number Diff line number Diff line change @@ -836,6 +836,12 @@ public void testAddJoinForManyToMany(SessionFactoryScope scope) {
836836 );
837837 }
838838
839+ @ Test @ JiraKey ( "HHH-15102" )
840+ @ SkipForDialect (dialectClass = MySQLDialect .class , matchSubTypes = true )
841+ public void testCommentInSQLQuery (SessionFactoryScope scope ) {
842+ scope .inTransaction ( s -> s .createNativeQuery ( "select sum(1) --count(*), effectively\n from ORGANIZATION" ).getSingleResult () );
843+ }
844+
839845 @ Test
840846 public void testTextTypeInSQLQuery (SessionFactoryScope scope ) {
841847 String description = buildLongString ( 15000 , 'a' );
You can’t perform that action at this time.
0 commit comments