Queries such as [executeQuery] are not currently supported in this GORM implementation.

I am trying to save spring -security-acl domain objects in mongodb using grails mongo plugin. By executing the following line of code

aclUtilService.addPermission Phone.class, phoneInstance.id, new PrincipalSid(username), BasePermission.ADMINISTRATION 

I get the following error:

In this GORM implementation, row-based queries such as [executeQuery] are not currently supported. Use criteria instead. Stacktrace follows: Message. String-based queries such as [executeQuery] are not currently supported in this GORM implementation. Use criteria instead.

Any plasters?

 **Grails Configuration Details:** app.grails.version=2.0.3 app.name=eateri app.servlet.version=2.5 app.version=0.1 plugins.mongodb=1.0.0.RC5 plugins.spring-security-acl=1.1 plugins.spring-security-core=1.2.7.2 
+6
source share
1 answer

As @sudhir mentioned, there are several methods in aclService that use the hql executeQuery method, for example:

  protected AclObjectIdentity retrieveObjectIdentity(ObjectIdentity oid) { return AclObjectIdentity.executeQuery( "FROM AclObjectIdentity " + "WHERE aclClass.className = :className " + " AND objectId = :objectId", [className: oid.type, objectId: oid.identifier])[0] } 

But the mongodb gorm plugin does not support hql, so the calling path where your code gets into the hql error is similar:

aclUtilService.addPermission → aclService.createAcl → retrieveObjectIdentity

And two more aclService methods using hql:

deleteEntries, findChildren

So, a simple solution for this is to save the ACL objects in mysql and enable hibernation working with gormon mongodb .

An alias must override these 3 aclService methods with metaprograms .

0
source

Source: https://habr.com/ru/post/918910/


All Articles