<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"https://hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <query name="findAllPermissionsByUser">
        <![CDATA[
            SELECT uhs
            FROM UserHasPermission uhs
            WHERE 
                uhs.user = :user
        ]]>
    </query>
    
    <query name="findAllPermissionsByUserAndGeneralAccess">
        <![CDATA[
            SELECT uhs
            FROM UserHasPermission uhs
            INNER JOIN Permission p ON uhs.permission = p.id
            WHERE 
                uhs.user = :user AND
                p.generalAccess in :generalAccess
        ]]>
    </query>
    
    
</hibernate-mapping>