I am having a method like this
@Modifying( clearAutomatically = true )
@Query( "update versioned LookupMaster set state = 'PUBLISHED' , value = newValue, newValue = null, updatedDate = current_timestamp where ( name = :tableName and state = 'MODIFIED')" )
void commitLookupTableChanges( String tableName );
It was working before springboot 3 upgrade. After springboot upgrade to version 3.0.2 facing validation error like below.
Caused by: java.lang.IllegalArgumentException: org.hibernate.query.SemanticException: The assignment expression type [java.lang.String] did not match the assignment path type [com.nokia.nsw.lookuptable.model.RowState] for the path [alias_2093546827.state] [update versioned LookupMaster set state = 'PUBLISHED' , value = newValue, newValue = null, updatedDate = current_timestamp where ( name = :tableName and state = 'MODIFIED')]
Code for Rowstate :
public enum RowState {
MODIFIED, DELETED, PUBLISHED
}
Remove the single quotes around PUBLISHED and MODIFIED. That is, change the query to:
update versioned LookupMaster set state = PUBLISHED, value = newValue, newValue = null, updatedDate = current_timestamp where ( name = :tableName and state = MODIFIED)
So that is a bug https://hibernate.atlassian.net/browse/HHH-16170 and we will get it fixed.
As a temporary workaround, you can write the query using a full-qualified name for the enum value:
update versioned LookupMaster set state = full.package.name.RowState.PUBLISHED, value = newValue, newValue = null, updatedDate = current_timestamp where ( name = :tableName and state = MODIFIED)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With