I've something like this:
<select id="group" parameterClass="HashMap" resultMap="group">
SELECT *
FROM GROUP
WHERE ID_USER_GROUP NOT IN (
SELECT GS.ID_USER_GROUP
FROM GROUP_SYSTEM GS, GROUP_USER GU
WHERE GS.ID_USER_GROUP = GU.ID_USER_GROUP
<dynamic prepend="WHERE">
<isNotEmpty prepend="AND" property="role">
GU.ID_ROLE = #role#
</isNotEmpty>
<isNotEmpty prepend="AND" property="userID">
GS.ID_USER = #userID#
</isNotEmpty>
</dynamic>
)
</select>
but this is throwing a "missing parenthesis" or something like this. The query in Toad is working properly (without the dynamic stuff of course).
I've seen this post but I cannot understand how to merge the open/close clauses. Do I need to call the select from somewhere else and iterate through the results?
Thanks in advance!