Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not resolve NativeQuery parameter type | Spring Boot update version 3

I'm trying to query a PostgreSQL database using a native query in Hibernate. Unfortunately whenever I try I get the error: Could not resolve NativeQuery parameter type : org.hibernate.query.internal.QueryParameterPositionalImpl@22.

That's the query:

@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query(value = "update table_name set column1=?3 where column1=?2 and parameter=?1", nativeQuery = true)
int myQuery(String parameter, Customer oldValue, Customer newValue);

Is it dependent on the SQL-Dialect settings in Intellij? I've set it to Generic SQL. Has anyone stumbled upon this problem before? Thanks in advice :)

like image 773
Michael Sparrow Avatar asked Sep 26 '26 04:09

Michael Sparrow


1 Answers

I've got the solution. The problem occured after the update of Spring Boot to the version 3. It's no longer possible to use the self-made java entities in native queries - Customer in this case.

The solution in this case was to replace the Customer entity with just the id of it.

like image 96
Michael Sparrow Avatar answered Sep 27 '26 22:09

Michael Sparrow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!