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:
- A MariaDB Dialect correct for my target DB is selected.
- 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!