JpaRepository findAll giving "Parameter index out of range" after update to Hibernate 6

Updating from Hibernate 5 to 6, I notice that attempting a JpaRepository.findAll for a particular entity is now yielding this exception:

2024-03-26T19:23:00,066-0400 DEBUG () [http-nio-9010-exec-8] o.h.e.j.s.SqlExceptionHelper - JDBC exception executing SQL [select am1_0.id,am1_0.application_id,am1_0.created_by,am1_0.created_date,am1_0.extended_data_id,am1_0.last_modified_by,am1_0.last_modified_date,am1_0.name,am1_0.uuid,am1_0.version from access_management am1_0 join applications a1_0 on a1_0.id=am1_0.application_id join clients c1_0 on c1_0.id=a1_0.client_id where c1_0.client_name=? and c1_0.uuid=? and c1_0.id=? and a1_0.uuid=? and a1_0.id=? and a1_0.application_name like ? escape '\' limit ?,?] [n/a]
java.sql.SQLException: Parameter index out of range (7 > number of parameters, which is 6).

Of note, the entity is different from others in my app in that it has this attribute:

	@ManyToMany(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)
	@JoinTable(
			name = "access_management_role_mapping",
			joinColumns = @JoinColumn(name = "access_management_id"),
			inverseJoinColumns = @JoinColumn(name = "roles_id"))
	@CsvBindByName(column = "roles")
	private List<Role> roles = new ArrayList<>();

I have ensured:

  1. A MariaDB Dialect correct for my target DB is selected.
  2. My Hibernate 5 application version, with unchanged Entity classes, is able to read this data.

I suspect that generated SQL / HQL is majorly wrong, as I’ve never seen anything like this before: escape '\', but I’m not sure how to approach troubleshooting this.

Any introductory suggestions? Thank you!

The exception clearly states that something tries to bind a parameter at index 7 though there are only 6 parameters. How come you conclude that this has something to do with the escape syntax?
Either way, please try to create a reproducer with our test case template and if you are able to reproduce the issue, create a bug ticket in our issue tracker and attach that reproducer.

Figured it out - the JpaRepository and Entity were fine. Instead, I was using a SearchExample object unknowingly, and it was malformed. Correcting that object or searching without it solved my issue.