[midPoint] <not> clause breaking xml query (midpoint 3.6)

Pavol Mederly mederly at evolveum.com
Tue Oct 3 07:38:10 CEST 2017


Hello,

you're right. The <not> clause doesn't work well (or maybe doesn't work 
at all) with multivalued items. The reason is that the translation of 
such queries to HQL/SQL is not so straightforward. Some kind of embedded 
query or something like that would be needed. You could create a JIRA 
for this if you want, but I am not sure when we'll have some time to 
implement that.

And yes, I know that the query interpreter (i.e. the code that 
translates midPoint queries to HQL queries) could be more polite and 
explain errors in a better way... again, not enough time for that. :-)

Best regards,

Pavol Mederly
Software developer
evolveum.com

On 02.10.2017 23:17, Alcides Carlos de Moraes Neto wrote:
> So, this only happens with multivalued fields. Single valued fields 
> work just fine. Is this as intended?
>
> 2017-09-28 18:51 GMT-03:00 Alcides Carlos de Moraes Neto 
> <alcides.neto at gmail.com <mailto:alcides.neto at gmail.com>>:
>
>     Hello all,
>
>     I'm trying to make a simple search query. I want to find all users
>     with an assignment, that don't have XYZ value for organizational unit.
>
>     I can do this just fine:
>     <query>
>         <filter>
>             <and>
>                 <ref>
>     <path>assignment/targetRef</path>
>                     <value oid="7d66fc64-1540-44da-8f3d-c565bc917e12"/>
>                 </ref>
>                 <equal>
>                     <path>organizationalUnit</path>
>                     <value>XYZ</value>
>                 </equal>
>             </and>
>         </filter>
>     </query>
>
>     This will fetch users with the assignment and the value
>     organizationalUnit XYZ
>
>     If I add the <not>...
>     <query>
>         <filter>
>             <and>
>                 <ref>
>     <path>assignment/targetRef</path>
>                     <value oid="7d66fc64-1540-44da-8f3d-c565bc917e12"/>
>                 </ref>
>                 <not>
>                   <equal>
>     <path>organizationalUnit</path>
>                       <value>NQPPPS</value>
>                   </equal>
>                 </not>
>             </and>
>         </filter>
>     </query>
>
>
>     This results in a hibernate error:
>     org.hibernate.HibernateException: SqlNode's text did not reference
>     expected number of columns at
>     org.hibernate.hql.internal.ast.tree.AbstractNullnessCheckNode.extractMutationTexts(AbstractNullnessCheckNode.java:151)
>     ...
>     at
>     com.evolveum.midpoint.repo.sql.query2.hqm.RootHibernateQuery.getAsHqlQuery(RootHibernateQuery.java:96)
>
>     Am I doing something wrong? Is it a bug? I'm using midpoint 3.6
>     Is there any other way to get what I want from a query?
>
>
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20171003/86918f24/attachment.htm>


More information about the midPoint mailing list