prepared join error `setting non null for parameter #1 with JdbcType null`
- Dominant language
- Go
- Stars
- 24.4k
- Forks
- 873
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 108
Description
A client hit an error with a prepared statement. Error log with simplified query:
```
2023-07-10 07:51:51.167 PM ERROR io.fusionauth.app.primeframework.error.ExceptionExceptionHandler - An unhandled exception was thrown
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='state', mode=IN, javaType=class io.fusionauth.domain.ObjectState, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: No parameters specified during prepareStatement() or prepareCall()
### The error may exist in io/fusionauth/api/domain/ApplicationMapper.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: WITH ids AS (
SELECT a.id
FROM applications AS a
INNER JOIN tenants AS t
ON t.id = a.tenants_id
WHERE a.data ->> '$.state' = ?
ORDER BY a.name ASC
LIMIT ?
OFFSET ?
)
SELECT *
FROM applications AS a
LEFT OUTER JOIN application_roles AS ar
ON a.id = ar.applications_id
INNER JOIN ids
ON ids.id = a.id
INNER JOIN tenants AS t
ON t.id = a.tenants_id
ORDER BY a.name ASC
```
Another query with same error:
```
### The error may exist in io/fusionauth/api/domain/GroupMapper.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: WITH ids AS (
SELECT g.id
FROM `groups` g
INNER JOIN tenants AS t
ON g.tenants_id = t.id
ORDER BY g.name ASC
LIMIT ?
OFFSET ?
)
SELECT *
FROM `groups` AS g
INNER JOIN tenants AS t
ON t.id = g.tenants_id
LEFT OUTER JOIN group_application_roles AS gar
ON g.id = gar.groups_id
LEFT OUTER JOIN application_roles AS ar
ON gar.application_roles_id = ar.id
INNER JOIN ids
ON ids.id = g.id
ORDER BY g.name ASC
### Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='numberOfResults', mode=IN, javaType=int, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: No parameters specified during prepareStatement() or prepareCall()
```
The errors indicate ` io/fusionauth/api/domain/ApplicationMapper.xml` and `io/fusionauth/api/domain/GroupMapper.xml` might be application-side culprits. More investigation needed to determine whether this is a user-error
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.