Hello.
I am using Spring Boot 3 and JPA in my project.
I have used the spring.jpa.properties.hibernate.format_sql: true
option for SQL log formatting.
and when using the following query with native query, SqlStatementLogger
produce the warning log.
(SELECT * FROM a_entity a1)
UNION
(SELECT * FROM a_entity a2)
ORDER BY id ASC
Can you provide a solution or a patch for this issue?
The following warning log has occurred. and there is a repository for reproducing the warning log and trying
yyyy-MM-ddTHH:mm:ss.SSS+09:00 WARN 63191 --- [ main] org.hibernate.SQL : Couldn't format statement
java.lang.IllegalArgumentException: count is negative: -1
at java.base/java.lang.String.repeat(String.java:4415) ~[na:na]
at org.hibernate.engine.jdbc.internal.BasicFormatterImpl$FormatProcess.newline(BasicFormatterImpl.java:405) ~[hibernate-core-6.2.2.Final.jar:6.2.2.Final]
at org.hibernate.engine.jdbc.internal.BasicFormatterImpl$FormatProcess.beginNewClause(BasicFormatterImpl.java:329) ~[hibernate-core-6.2.2.Final.jar:6.2.2.Final]
at org.hibernate.engine.jdbc.internal.BasicFormatterImpl$FormatProcess.perform(BasicFormatterImpl.java:157) ~[hibernate-core-6.2.2.Final.jar:6.2.2.Final]
at org.hibernate.engine.jdbc.internal.BasicFormatterImpl.format(BasicFormatterImpl.java:33) ~[hibernate-core-6.2.2.Final.jar:6.2.2.Final]
at org.hibernate.engine.jdbc.spi.SqlStatementLogger.logStatement(SqlStatementLogger.java:123) ~[hibernate-core-6.2.2.Final.jar:6.2.2.Final]
at org.hibernate.engine.jdbc.spi.SqlStatementLogger.logStatement(SqlStatementLogger.java:106) ~[hibernate-core-6.2.2.Final.jar:6.2.2.Final]