You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using @query for update statements should work imho, I could not find some documentation that the @query cannot be used for update statements from spring-data-hazelcast, but could also not find an example.
From the hazelcast docs it states that update sql should work.
Question: Should it be possible to do a @query with an UPDATE statement?
During debugging, i found the following info:
Using a statement like: @query("UPDATE table set field = '%s' WHERE id = '%d' ")
Isn't working due to some code issues I have found. I have listed some points that can be improved/enhanced to ensure an update statement can be proecessed. I think the whole parsing etc is only build for select not for updates...
Some points I found, debuggin the code:
SqlParser:
if (token.equals(")")) {
```
I am not fully understaning why the whole sqlparser is done.
THe first step actually already defines the sql that should be able to work.
`StringBasedHazelcastRepositoryQuery:execute`
shows the queryString, that seems to be already sql that would be executed.
Beside that, the processing of the SqlParser isn't handling "(" correclty, in the sense that for the UPDATE it is using the stack and this means the actual token list is wrongly defined.
Next to that the `SqlPRedicate` isn't working as well. The `createComparison EQUAL_FACTORY` isn't indexing the token list correctly
```
StringBasedHazelcastRepositoryQuery::execute
String queryString = String.format(queryStringTemplate, formatParameters(parameters));
```
Using String format is a bit limiting, but works if used correctly within the @Query statement.
Would be nicer to support something like parameters:
```
@Query("select u from User u where u.firstname = :firstname")
List<User> findUsersByCustomersFirstname(@Param("firstname")String firstName);
```
The text was updated successfully, but these errors were encountered:
I am trying to do an update @query, this fails
Using @query for update statements should work imho, I could not find some documentation that the @query cannot be used for update statements from spring-data-hazelcast, but could also not find an example.
From the hazelcast docs it states that update sql should work.
Question: Should it be possible to do a @query with an UPDATE statement?
During debugging, i found the following info:
Using a statement like:
@query("UPDATE table set field = '%s' WHERE id = '%d' ")
Isn't working due to some code issues I have found. I have listed some points that can be improved/enhanced to ensure an update statement can be proecessed. I think the whole parsing etc is only build for select not for updates...
Some points I found, debuggin the code:
The text was updated successfully, but these errors were encountered: