Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 2.0.1
-
Fix Version/s: 2.0.2
-
Component/s: Persistence
-
Environment:Ubuntu 11.10 64bit, Java 7 (not relevant for the issue)
Description
Create a detached query for a domain class like this
def criteria = MyDomain.where {
myInt == 10
myString =~ "myString%"
}
The query works when using criteria.findAll() but fails when trying to update or delete the resulting records:
def resultCount = criteria.updateAll(myInt: 20)
The bug seems to be located in org.grails.datastore.mapping.query.jpa.JpaQueryBuilder:586 where the query is appended to the projection and not to the selection part.
The resulting query then looks like:
UPDATE grails_ilike.MyDomain myDomain SET myDomain.myInt=?lower(myDomain.myString) like lower(?) WHERE (myDomain.myInt=? AND )
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
fixed by https://github.com/SpringSource/grails-data-mapping/commit/23ac1ccc6545edbe22c6e0c9aef463171a70f705