This is a known formatting issue with Hibernate's show_sql output. The actual SQL query is correct and executes properly with proper parentheses, but the show_sql display has formatting problems.You can verify in this way:
spring.jpa.properties.hibernate.use_sql_comments=true