Skip to content

Commit

Permalink
Merge pull request #40954 from geoand/#40921
Browse files Browse the repository at this point in the history
Highlight Hibernate generated SQL queries
  • Loading branch information
geoand authored Jun 4, 2024
2 parents 62b8fe5 + 66cffe5 commit 6f0aebc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ private static void injectRuntimeConfiguration(HibernateOrmRuntimeConfigPersiste
if (persistenceUnitConfig.log().formatSql()) {
runtimeSettingsBuilder.put(AvailableSettings.FORMAT_SQL, "true");
}

if (persistenceUnitConfig.log().highlightSql()) {
runtimeSettingsBuilder.put(AvailableSettings.HIGHLIGHT_SQL, "true");
}
}

if (persistenceUnitConfig.log().jdbcWarnings().isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ interface HibernateOrmConfigPersistenceUnitLog {
@WithDefault("true")
boolean formatSql();

/**
* Highlight the SQL logs if SQL log is enabled
*/
@WithDefault("true")
boolean highlightSql();

/**
* Whether JDBC warnings should be collected and logged.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ private static void injectRuntimeConfiguration(HibernateOrmRuntimeConfigPersiste
if (persistenceUnitConfig.log().formatSql()) {
runtimeSettingsBuilder.put(AvailableSettings.FORMAT_SQL, "true");
}

if (persistenceUnitConfig.log().highlightSql()) {
runtimeSettingsBuilder.put(AvailableSettings.HIGHLIGHT_SQL, "true");
}
}

if (persistenceUnitConfig.log().jdbcWarnings().isPresent()) {
Expand Down

0 comments on commit 6f0aebc

Please sign in to comment.