blob: 3ef8ba32f3fe0a6bc2e6f6e2cb70b8a64e08e2bb [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
You under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<entity-mappings version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd ">
<named-query name="XXAuthSession.getUserLoggedIn">
<query>SELECT count(obj),function('DATE',obj.authTime) as dateAuth
FROM XXAuthSession obj
GROUP BY dateAuth
</query>
</named-query>
<named-query name="XXAuthSession.getAuthSessionBySessionId">
<query>SELECT obj FROM XXAuthSession obj
WHERE obj.extSessionId = :sessionId
</query>
</named-query>
<!-- XXPortalUser -->
<named-query name="XXPortalUser.findByEmailAddress">
<query>SELECT obj FROM XXPortalUser obj WHERE obj.emailAddress =
:emailAddress</query>
</named-query>
<named-query name="XXPortalUser.findByLoginId">
<query>SELECT obj FROM XXPortalUser obj WHERE obj.loginId = :loginId</query>
</named-query>
<named-query name="XXPortalUser.findByPublicScreenName">
<query>SELECT obj FROM XXPortalUser obj WHERE obj.publicScreenName =
:publicScreenName</query>
</named-query>
<named-query name="XXPortalUser.findByRole">
<query>SELECT obj FROM XXPortalUser obj, XXPortalUserRole role WHERE obj.id = role.userId
and role.userRole = :userRole</query>
</named-query>
<named-query name="XXPortalUser.getUserAddedReport">
<query>SELECT count(obj), function('DATE',obj.createTime) as createDate FROM XXPortalUser obj GROUP BY createDate
</query>
</named-query>
<!-- XXPolicyLabels -->
<named-query name="XXPolicyLabel.findByName">
<query>SELECT obj FROM XXPolicyLabel obj WHERE obj.policyLabel = :policyLabel
</query>
</named-query>
<named-query name="XXPolicyLabel.findByPolicyLabelId">
<query>SELECT obj FROM XXPolicyLabel obj WHERE obj.id = :policyLabelId
</query>
</named-query>
<named-query name="XXPolicyLabel.findByServiceId">
<query>SELECT obj FROM XXPolicyLabel obj WHERE obj.id in (select policyLabelMap.policyLabelId from XXPolicyLabelMap policyLabelMap where policyLabelMap.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)) order by obj.id
</query>
</named-query>
<named-query name="XXPolicyLabel.findByPolicyId">
<query>SELECT obj FROM XXPolicyLabel as obj WHERE obj.id in (select policyLabelMap.policyLabelId from XXPolicyLabelMap as policyLabelMap where policyLabelMap.policyId in (select policy.id from XXPolicy policy where policy.id = :policyId)) order by obj.id
</query>
</named-query>
<named-query name="XXPolicyLabel.getAllPolicyLabels">
<query>select obj from XXPolicyLabel obj where obj.id is NOT null
</query>
</named-query>
<!-- XXPolicyLabelMap -->
<named-query name="XXPolicyLabelMap.findByPolicyId">
<query>SELECT obj FROM XXPolicyLabelMap obj WHERE obj.policyId = :policyId
</query>
</named-query>
<named-query name="XXPolicyLabelMap.findByPolicyLabelId">
<query>SELECT obj FROM XXPolicyLabelMap obj WHERE obj.id = :policyLabelId
</query>
</named-query>
<named-query name="XXPolicyLabelMap.findByServiceId">
<query>SELECT obj FROM XXPolicyLabelMap obj WHERE obj.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)
order by obj.policyId, obj.id
</query>
</named-query>
<!-- XXPortalUserRole -->
<named-query name="XXPortalUserRole.findByRoleUserId">
<query>SELECT obj FROM XXPortalUserRole obj WHERE obj.userId = :userId
and obj.userRole = :userRole</query>
</named-query>
<named-query name="XXPortalUserRole.findByUserId">
<query>SELECT obj FROM XXPortalUserRole obj WHERE obj.userId = :userId
</query>
</named-query>
<named-query name="XXPortalUserRole.findByParentId">
<query>SELECT obj FROM XXPortalUserRole obj WHERE obj.userId = :parentId
</query>
</named-query>
<!-- XXAsset -->
<named-query name="XXAsset.findByAssetName">
<query>SELECT obj FROM XXAsset obj WHERE obj.name = :name AND obj.activeStatus != :status
</query>
</named-query>
<!-- XXAuditMap -->
<named-query name="XXAuditMap.findByResourceId">
<query>SELECT obj FROM XXAuditMap obj WHERE obj.resourceId = :resourceId
</query>
</named-query>
<!-- XXGroup -->
<named-query name="XXGroup.findByUserId">
<query>SELECT obj FROM XXGroup obj, XXGroupUser groupUser
WHERE obj.id = groupUser.parentGroupId and groupUser.userId = :userId
</query>
</named-query>
<!-- XXGroup -->
<named-query name="XXUser.findGroupsByUserIds">
<query>SELECT user.name, group.name FROM XXUser user, XXGroup group, XXGroupUser groupUser
WHERE user.id=groupUser.userId and group.id=groupUser.parentGroupId
</query>
</named-query>
<named-query name="XXUser.getAllUserIds">
<query>SELECT user.name, user.id FROM XXUser user
</query>
</named-query>
<named-query name="XXGroupUser.findUsersByGroupIds">
<query>SELECT group.name, user.name FROM XXUser user, XXGroup group, XXGroupUser groupUser
WHERE user.id=groupUser.userId and group.id=groupUser.parentGroupId
</query>
</named-query>
<named-query name="XXGroupUser.findUsersByGroupName">
<query>SELECT user.name, groupUser FROM XXUser user, XXGroupUser groupUser
WHERE user.id=groupUser.userId and groupUser.name = :groupName
</query>
</named-query>
<!-- XXPermMap -->
<named-query name="XXPermMap.findByResourceId">
<query>SELECT obj FROM XXPermMap obj WHERE obj.resourceId = :resourceId
</query>
</named-query>
<!-- XXResource -->
<named-query name="XXResource.findUpdatedResourcesByAssetId">
<query>SELECT obj FROM XXResource obj WHERE obj.assetId = :assetId
AND obj.updateTime &gt; :lastUpdated
</query>
</named-query>
<named-query name="XXResource.findUpdatedResourcesByAssetName">
<query>SELECT obj FROM XXResource obj, XXAsset xAsset
WHERE obj.assetId = xAsset.id
AND xAsset.name = :assetName
AND obj.updateTime &gt; :lastUpdated
</query>
</named-query>
<named-query name="XXResource.findByAssetId">
<query>SELECT obj FROM XXResource obj WHERE obj.assetId = :assetId
</query>
</named-query>
<named-query name="XXResource.findByAssetType">
<query>SELECT obj FROM XXResource obj, XXAsset xxAsset
WHERE xxAsset.id = obj.assetId
and xxAsset.assetType = :assetType
</query>
</named-query>
<named-query name="XXResource.findByResourceName">
<query>SELECT obj FROM XXResource obj WHERE obj.name = :name
</query>
</named-query>
<named-query name="XXResource.findByResourceNameAndAssetIdAndRecursiveFlag">
<query>SELECT obj FROM XXResource obj WHERE obj.name like :name and obj.assetId=:assetId
and obj.isRecursive=:isRecursive
</query>
</named-query>
<named-query name="XXResource.findByResourceNameAndAssetIdAndResourceType">
<query>SELECT obj FROM XXResource obj WHERE obj.name like :name and obj.assetId=:assetId
and obj.resourceType=:resourceType
</query>
</named-query>
<named-query name="XXResource.getMaxUpdateTimeForAssetName">
<query>SELECT MAX(obj.updateTime) FROM XXResource obj, XXAsset xAsset
WHERE obj.assetId = xAsset.id
AND xAsset.name = :assetName
</query>
</named-query>
<named-query name="XXResource.findByAssetIdAndResourceStatus">
<query>SELECT obj FROM XXResource obj WHERE obj.assetId = :assetId and
obj.resourceStatus = :resourceStatus
</query>
</named-query>
<named-query name="XXUser.findByUserName">
<query>SELECT Obj FROM XXUser obj
WHERE obj.name=:name
</query>
</named-query>
<named-query name="XXGroup.findByGroupName">
<query>SELECT Obj FROM XXGroup obj
WHERE obj.name=:name
</query>
</named-query>
<named-query name="XXGroupUser.deleteByGroupIdAndUserId">
<query>DELETE FROM XXGroupUser obj
WHERE obj.parentGroupId=:parentGroupId
AND obj.userId=:userId
</query>
</named-query>
<named-query name="XXGroupUser.findByUserId">
<query>SELECT obj FROM XXGroupUser obj
WHERE obj.userId=:userId
</query>
</named-query>
<named-query name="XXGroupUser.findGroupIdListByUserId">
<query>SELECT obj.parentGroupId FROM XXGroupUser obj WHERE obj.userId=:xUserId
</query>
</named-query>
<named-query name="XXGroupUser.findGroupNamesByUserName">
<query>SELECT obj.name FROM XXGroup obj
WHERE obj.id IN (SELECT gu.parentGroupId FROM XXGroupUser gu, XXUser u
WHERE gu.userId = u.id AND u.name=:userName)
</query>
</named-query>
<named-query name="XXGroupUser.findByGroupId">
<query>SELECT obj FROM XXGroupUser obj WHERE obj.parentGroupId=:groupId
</query>
</named-query>
<named-query name="XXGroupUser.findByGroupNameAndUserId">
<query>SELECT obj FROM XXGroupUser obj WHERE obj.name=:groupName AND obj.userId=:userId
</query>
</named-query>
<named-query name="XXTrxLog.findByTrxId">
<query>SELECT obj FROM XXTrxLog obj WHERE obj.transactionId = :transactionId
</query>
</named-query>
<named-query name="XXUser.findByPortalUserId">
<query>select obj from XXUser obj, XXPortalUser portalUser where portalUser.id = :portalUserId and
obj.name = portalUser.loginId</query>
</named-query>
<!-- XXPolicyItem -->
<named-query name="XXPolicyItem.findByPolicyId">
<query>select obj from XXPolicyItem obj
where obj.policyId = :policyId
order by obj.id
</query>
</named-query>
<named-query name="XXPolicyItem.findByServiceId">
<query>select obj from XXPolicyItem obj
where obj.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)
order by obj.policyId, obj.id
</query>
</named-query>
<named-query name="XXPolicyItem.deleteByPolicyId">
<query>DELETE FROM XXPolicyItem obj WHERE obj.policyId = :policyId</query>
</named-query>
<!-- XXPolicy -->
<named-query name="XXPolicy.countById">
<query>select count(obj.id) from XXPolicy obj where obj.id = :policyId</query>
</named-query>
<named-query name="XXPolicy.findByPolicyName">
<query>select obj from XXPolicy obj where obj.name = :polName order by obj.id</query>
</named-query>
<named-query name="XXPolicy.findByNameAndServiceIdAndZoneId">
<query>select obj from XXPolicy obj where obj.name = :polName and obj.service = :serviceId and obj.zoneId = :zoneId order by obj.id</query>
</named-query>
<named-query name="XXPolicy.findByServiceId">
<query>select obj from XXPolicy obj where obj.service = :serviceId order by obj.id</query>
</named-query>
<named-query name="XXPolicy.findPolicyIdsByServiceId">
<query>select obj.id from XXPolicy obj where obj.service = :serviceId</query>
</named-query>
<named-query name="XXPolicy.getMaxIdOfXXPolicy">
<query>select MAX(obj.id) from XXPolicy obj</query>
</named-query>
<named-query name="XXPolicy.findByResourceSignatureByPolicyStatus">
<query>select obj from XXPolicy obj, XXService xSvc where obj.service = xSvc.id
and obj.resourceSignature = :resSignature and xSvc.name = :serviceName and obj.isEnabled = :isPolicyEnabled</query>
</named-query>
<!-- currently not exposed but should be when we have a use case for it -->
<named-query name="XXPolicy.findByResourceSignature">
<query>select obj from XXPolicy obj, XXService xSvc where obj.service = xSvc.id
and obj.resourceSignature = :resSignature and xSvc.name = :serviceName</query>
</named-query>
<named-query name="XXPolicy.findByServiceDefId">
<query>select obj from XXPolicy obj, XXService svc where
obj.service = svc.id and svc.type = :serviceDefId</query>
</named-query>
<named-query name="XXPolicy.findPolicyIdsByServiceNameAndZoneId">
<query>select obj.id from XXPolicy obj, XXService svc where obj.zoneId = :zoneId and obj.service = svc.id and svc.name = :serviceName</query>
</named-query>
<named-query name="XXPolicy.findByRoleId">
<query>select obj from XXPolicy obj, XXPolicyRefRole policyRefRole where policyRefRole.roleId = :roleId and policyRefRole.policyId = obj.id order by obj.service</query>
</named-query>
<named-query name="XXPolicy.findServiceIdsByRoleId">
<query>select DISTINCT(obj.service) from XXPolicy obj, XXPolicyRefRole policyRefRole where policyRefRole.roleId = :roleId and policyRefRole.policyId = obj.id</query>
</named-query>
<named-query name="XXPolicy.findPolicyByPolicyNameAndServiceName">
<query>select obj from XXPolicy obj, XXService svc where obj.name = :policyName and obj.service = svc.id and svc.name = :serviceName and obj.zoneId = :zoneId</query>
</named-query>
<named-query name="XXPolicy.findPolicyByPolicyNameAndServiceNameAndZoneName">
<query>select obj from XXPolicy obj, XXService svc, XXSecurityZone zone where obj.name = :policyName and obj.service = svc.id and svc.name = :serviceName and obj.zoneId = zone.id and zone.name = :zoneName</query>
</named-query>
<named-query name="XXPolicy.findRoleRefPolicyCount">
<query>select count(roleRef.policyId)
from XXPolicy policy, XXPolicyRefRole roleRef
where policy.service = :serviceId
and roleRef.policyId = policy.id
and roleRef.roleName = :roleName
</query>
</named-query>
<named-query name="XXPolicy.getPoliciesCount">
<query>select count(policy.id)
from XXPolicy policy, XXService service
where service.name = :serviceName and service.id = policy.service
</query>
</named-query>
<named-query name="XXPolicy.getAllByPolicyItem">
<query>select obj from XXPolicy obj where obj.id in (select item.policyId from XXPolicyItem item) </query>
</named-query>
<!-- XXServiceDef -->
<named-query name="XXServiceDef.findByName">
<query>select obj from XXServiceDef obj where obj.name = :name</query>
</named-query>
<named-query name="XXServiceDef.findByDisplayName">
<query>select obj from XXServiceDef obj where obj.displayName = :displayName</query>
</named-query>
<named-query name="XXServiceDef.getMaxIdOfXXServiceDef">
<query>select MAX(obj.id) from XXServiceDef obj</query>
</named-query>
<named-query name="XXServiceDef.findServiceDefNameByServiceName">
<query>select obj.name from XXServiceDef obj, XXService serviceObj where obj.id = serviceObj.type and serviceObj.name = :name</query>
</named-query>
<named-query name="XXServiceDef.findServiceDefNameByServiceId">
<query>select obj.name from XXServiceDef obj, XXService serviceObj where obj.id = serviceObj.type and serviceObj.id = :id</query>
</named-query>
<!-- XXResourceDef -->
<named-query name="XXResourceDef.findByNameAndDefId">
<query>select obj from XXResourceDef obj where obj.name = :name and obj.defId = :defId order by obj.level</query>
</named-query>
<named-query name="XXResourceDef.findByServiceDefId">
<query>select obj from XXResourceDef obj where obj.defId = :serviceDefId order by obj.level</query>
</named-query>
<named-query name="XXResourceDef.findByPolicyId">
<query>select obj from XXResourceDef obj, XXPolicy xPol, XXServiceDef xSvcDef,
XXService xSvc where obj.defId = xSvcDef.id and xSvcDef.id = xSvc.type
and xSvc.id = xPol.service and xPol.id = :policyId order by obj.level</query>
</named-query>
<named-query name="XXResourceDef.findByNameAndPolicyId">
<query>select obj from XXResourceDef obj, XXPolicy xPol, XXServiceDef xSvcDef,
XXService xSvc where obj.defId = xSvcDef.id and xSvcDef.id = xSvc.type
and xSvc.id = xPol.service and xPol.id = :policyId and obj.name = :name order by obj.level</query>
</named-query>
<named-query name="XXResourceDef.findByParentResId">
<query>
select obj from XXResourceDef obj where obj.parent = :parentId
</query>
</named-query>
<!-- XXAccessTypeDefGrants -->
<named-query name="XXAccessTypeDefGrants.findImpliedGrantsByATDId">
<query>select obj.impliedGrant from XXAccessTypeDefGrants obj where obj.atdId = :atdId</query>
</named-query>
<named-query name="XXAccessTypeDefGrants.findByNameAndATDId">
<query>select obj from XXAccessTypeDefGrants obj where obj.impliedGrant = :name and obj.atdId = :atdId</query>
</named-query>
<named-query name="XXAccessTypeDefGrants.findByATDId">
<query>select obj from XXAccessTypeDefGrants obj where obj.atdId = :atdId</query>
</named-query>
<!-- XXEnumElementDef -->
<named-query name="XXEnumElementDef.findByEnumDefId">
<query>select obj from XXEnumElementDef obj where obj.enumDefId = :enumDefId order by obj.order</query>
</named-query>
<!-- XXServiceConfigDef -->
<named-query name="XXServiceConfigDef.findByServiceDefId">
<query>select obj from XXServiceConfigDef obj where obj.defId = :serviceDefId order by obj.order</query>
</named-query>
<named-query name="XXServiceConfigDef.findByServiceDefName">
<query>select obj from XXServiceConfigDef obj, XXServiceDef svcDef
where obj.defId = svcDef.id and svcDef.name = :serviceDef order by obj.order</query>
</named-query>
<!-- XXAccessTypeDef -->
<named-query name="XXAccessTypeDef.findByServiceDefId">
<query>select obj from XXAccessTypeDef obj where obj.defId = :serviceDefId order by obj.order</query>
</named-query>
<named-query name="XXAccessTypeDef.findByNameAndServiceId">
<query>select obj from XXAccessTypeDef obj, XXService xSvc where
obj.name = :name and xSvc.id = :serviceId and obj.defId = xSvc.type</query>
</named-query>
<!-- XXPolicyConditionDef -->
<named-query name="XXPolicyConditionDef.findByServiceDefId">
<query>select obj from XXPolicyConditionDef obj where obj.defId = :serviceDefId order by obj.order</query>
</named-query>
<named-query name="XXPolicyConditionDef.findByServiceDefIdAndName">
<query>select obj from XXPolicyConditionDef obj where obj.defId = :serviceDefId and obj.name = :name order by obj.order</query>
</named-query>
<!-- XXContextEnricherDef -->
<named-query name="XXContextEnricherDef.findByServiceDefId">
<query>select obj from XXContextEnricherDef obj where obj.defId = :serviceDefId order by obj.order</query>
</named-query>
<named-query name="XXContextEnricherDef.findByServiceDefIdAndName">
<query>select obj from XXContextEnricherDef obj where obj.defId = :serviceDefId and obj.name = :name order by obj.order</query>
</named-query>
<!-- XXEnumDef -->
<named-query name="XXEnumDef.findByServiceDefId">
<query>select obj from XXEnumDef obj where obj.defId = :serviceDefId</query>
</named-query>
<!-- XXDataMaskTypeDef -->
<named-query name="XXDataMaskTypeDef.findByServiceDefId">
<query>select obj from XXDataMaskTypeDef obj where obj.defId = :serviceDefId order by obj.order</query>
</named-query>
<named-query name="XXDataMaskTypeDef.findByNameAndServiceId">
<query>select obj from XXDataMaskTypeDef obj, XXService xSvc where
obj.name = :name and xSvc.id = :serviceId and obj.defId = xSvc.type</query>
</named-query>
<!-- XXServiceConfigMap -->
<named-query name="XXServiceConfigMap.findByServiceId">
<query>select obj from XXServiceConfigMap obj where obj.serviceId = :serviceId</query>
</named-query>
<named-query name="XXServiceConfigMap.findByServiceAndConfigKey">
<query>select obj from XXServiceConfigMap obj where
obj.serviceId = :serviceId and obj.configKey = :configKey</query>
</named-query>
<named-query name="XXServiceConfigMap.findByServiceNameAndConfigKey">
<query>select obj from XXServiceConfigMap obj, XXService xSvc where
xSvc.name = :name and xSvc.id=obj.serviceId and obj.configKey = :configKey</query>
</named-query>
<named-query name="XXServiceConfigMap.findServiceIdsByConfigKeyAndConfigValueAndFilterByServiceType">
<query>SELECT xscm.serviceId FROM XXServiceConfigMap xscm, XXService xs, XXServiceDef xsd
WHERE xscm.configKey = :configKey AND xscm.configValue = :configValue
AND xscm.serviceId = xs.id AND xs.type = xsd.id
AND xsd.name != :serviceType
</query>
</named-query>
<!-- XXService -->
<named-query name="XXService.findByName">
<query>select obj from XXService obj where obj.name = :name</query>
</named-query>
<named-query name="XXService.findByDisplayName">
<query>select obj from XXService obj where obj.displayName = :displayName</query>
</named-query>
<named-query name="XXService.getMaxIdOfXXService">
<query>select MAX(obj.id) from XXService obj</query>
</named-query>
<named-query name="XXService.findByServiceDefId">
<query>select obj from XXService obj where obj.type = :serviceDefId</query>
</named-query>
<named-query name="XXService.findByTagServiceId">
<query>select obj from XXService obj where obj.tagService = :tagServiceId</query>
</named-query>
<named-query name="XXService.findAssociatedTagService">
<query>select obj from XXService obj
where obj.name = :serviceName
and obj.tagService is NOT null
and exists (select tagService from XXService tagService where obj.tagService = tagService.id and tagService.isEnabled = TRUE)
</query>
</named-query>
<named-query name="XXService.getAllServicesWithTagService">
<query>select obj from XXService obj
where obj.tagService is NOT null
and exists (select tagService from XXService tagService where obj.tagService = tagService.id and tagService.isEnabled = TRUE)
</query>
</named-query>
<named-query name="XXService.getAllServiceIds">
<query>select obj.id from XXService obj</query>
</named-query>
<!-- XXServiceVersionInfo -->
<named-query name="XXServiceVersionInfo.findByServiceName">
<query>
select obj from XXServiceVersionInfo obj, XXService service where obj.serviceId = service.id and service.name = :serviceName
</query>
</named-query>
<named-query name="XXServiceVersionInfo.findByServiceId">
<query>select obj from XXServiceVersionInfo obj where obj.serviceId = :serviceId</query>
</named-query>
<named-query name="XXServiceVersionInfo.getAllWithServiceNames">
<query>select obj, service.name from XXServiceVersionInfo obj, XXService service where obj.serviceId = service.id</query>
</named-query>
<named-query name="XXServiceVersionInfo.findByServiceResourceId">
<query>
select obj from XXServiceVersionInfo obj where obj.serviceId in
(select res.serviceId from XXServiceResource res where res.id = :resourceId)
</query>
</named-query>
<named-query name="XXServiceVersionInfo.findByTagId">
<query>
select obj from XXServiceVersionInfo obj where obj.serviceId in
(select res.serviceId from XXServiceResource res, XXTagResourceMap tagRes
where res.id = tagRes.resourceId and tagRes.tagId = :tagId)
</query>
</named-query>
<named-query name="XXServiceVersionInfo.findByTagDefId">
<query>
select obj from XXServiceVersionInfo obj where obj.serviceId in
(select res.serviceId from XXServiceResource res, XXTagResourceMap tagRes, XXTag tag
where res.id = tagRes.resourceId and tagRes.tagId = tag.id and tag.type = :tagDefId)
</query>
</named-query>
<!-- XXPolicyResource -->
<named-query name="XXPolicyResource.findByPolicyId">
<query>select obj from XXPolicyResource obj
where obj.policyId = :policyId
order by obj.id
</query>
</named-query>
<named-query name="XXPolicyResource.findByServiceId">
<query>select obj from XXPolicyResource obj
where obj.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)
order by obj.policyId, obj.id
</query>
</named-query>
<named-query name="XXPolicyResource.findByResDefId">
<query>select obj from XXPolicyResource obj where obj.resDefId = :resDefId</query>
</named-query>
<named-query name="XXPolicyResource.deleteByPolicyId">
<query>DELETE FROM XXPolicyResource obj WHERE obj.policyId = :policyId</query>
</named-query>
<named-query name="XXPolicyResourceMap.findByPolicyId">
<query>select obj from XXPolicyResourceMap obj, XXPolicyResource res
where obj.resourceId = res.id
and res.policyId = :policyId
order by obj.resourceId, obj.order
</query>
</named-query>
<named-query name="XXPolicyResourceMap.findByServiceId">
<query>select obj from XXPolicyResourceMap obj, XXPolicyResource res
where obj.resourceId = res.id
and res.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)
order by res.policyId, obj.resourceId, obj.order
</query>
</named-query>
<named-query name="XXPolicyResourceMap.deleteByPolicyId">
<query>DELETE FROM XXPolicyResourceMap obj WHERE obj.resourceId in (select res.id from XXPolicyResource res where res.policyId = :policyId)</query>
</named-query>
<!-- XXPolicyItemAccess -->
<named-query name="XXPolicyItemAccess.findByPolicyId">
<query>select obj from XXPolicyItemAccess obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId = :policyId
order by obj.policyItemId, obj.order
</query>
</named-query>
<named-query name="XXPolicyItemAccess.findByServiceId">
<query>select obj from XXPolicyItemAccess obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)
order by item.policyId, obj.policyItemId, obj.order
</query>
</named-query>
<named-query name="XXPolicyItemAccess.deleteByPolicyId">
<query>DELETE FROM XXPolicyItemAccess obj WHERE obj.policyItemId in (select item.id from XXPolicyItem item where item.policyId = :policyId)</query>
</named-query>
<!-- XXPolicyRefAccessType -->
<named-query name="XXPolicyRefAccessType.findByPolicyId">
<query>select obj from XXPolicyRefAccessType obj where obj.policyId = :policyId </query>
</named-query>
<named-query name="XXPolicyRefAccessType.findByAccessTypeDefId">
<query>select obj from XXPolicyRefAccessType obj where obj.accessDefId = :accessDefId</query>
</named-query>
<named-query name="XXPolicyRefAccessType.deleteByPolicyId">
<query>DELETE FROM XXPolicyRefAccessType obj WHERE obj.policyId = :policyId</query>
</named-query>
<!-- XXPolicyRefCondition -->
<named-query name="XXPolicyRefCondition.findByPolicyId">
<query>select obj from XXPolicyRefCondition obj where obj.policyId = :policyId </query>
</named-query>
<named-query name="XXPolicyRefCondition.findByConditionName">
<query>select obj from XXPolicyRefCondition obj where obj.conditionName = :conditionName</query>
</named-query>
<named-query name="XXPolicyRefCondition.deleteByPolicyId">
<query>DELETE FROM XXPolicyRefCondition obj WHERE obj.policyId = :policyId </query>
</named-query>
<!-- XXPolicyRefGroup -->
<named-query name="XXPolicyRefGroup.findByPolicyId">
<query>select obj from XXPolicyRefGroup obj where obj.policyId = :policyId </query>
</named-query>
<named-query name="XXPolicyRefGroup.findByGroupName">
<query>select obj from XXPolicyRefGroup obj where obj.groupName = :groupName</query>
</named-query>
<!-- new queries -->
<named-query name="XXPolicyRefGroup.findByGroupIdAndPolicyId">
<query>select obj from XXPolicyRefGroup obj where obj.groupId = :groupId and obj.policyId = :policyId </query>
</named-query>
<named-query name="XXPolicyRefGroup.deleteByPolicyId">
<query>DELETE FROM XXPolicyRefGroup obj WHERE obj.policyId = :policyId</query>
</named-query>
<named-query name="XXPolicyRefCondition.findByConditionDefIdAndPolicyId">
<query>select obj from XXPolicyRefCondition obj where obj.conditionDefId = :conditionDefId and obj.policyId = :policyId </query>
</named-query>
<named-query name="XXPolicyRefCondition.findByConditionDefId">
<query>select obj from XXPolicyRefCondition obj where obj.conditionDefId = :conditionDefId </query>
</named-query>
<named-query name="XXUser.findUpdatedUserNames">
<query>select distinct obj from XXUser obj, XXPolicyRefUser ref where ref.policyId = :policyId and ref.userId = obj.id
and ref.userName != obj.name</query>
</named-query>
<named-query name="XXAccessTypeDef.findUpdatedAccessDefNames">
<query>select distinct obj from XXAccessTypeDef obj, XXPolicyRefAccessType ref where ref.policyId = :policyId and ref.accessDefId = obj.id
and ref.accessTypeName != obj.name</query>
</named-query>
<named-query name="XXDataMaskTypeDef.findUpdatedDataMaskDefNames">
<query>select distinct obj from XXDataMaskTypeDef obj, XXPolicyRefDataMaskType ref where ref.policyId = :policyId and ref.dataMaskDefId = obj.id
and ref.dataMaskTypeName != obj.name</query>
</named-query>
<named-query name="XXResourceDef.findUpdatedResourceDefNames">
<query>select distinct obj from XXResourceDef obj, XXPolicyRefResource ref where ref.policyId = :policyId and ref.resourceDefId = obj.id
and ref.resourceName != obj.name</query>
</named-query>
<named-query name="XXPolicyRefGroup.findUpdatedGroupNamesByPolicy">
<query>select groupRef.policyId, groupRef.groupName, grp.name
from XXPolicyRefGroup groupRef, XXGroup grp
where groupRef.policyId = :policy
and groupRef.groupId = grp.id
and groupRef.groupName != grp.name
</query>
</named-query>
<named-query name="XXPolicyRefGroup.findUpdatedGroupNamesByService">
<query>select groupRef.policyId, groupRef.groupName, grp.name
from XXPolicy policy, XXPolicyRefGroup groupRef, XXGroup grp
where policy.service = :service
and groupRef.policyId = policy.id
and groupRef.groupId = grp.id
and groupRef.groupName != grp.name
</query>
</named-query>
<named-query name="XXPolicyRefUser.findUpdatedUserNamesByPolicy">
<query>select userRef.policyId, userRef.userName, user.name
from XXPolicyRefUser userRef, XXUser user
where userRef.policyId = :policy
and userRef.userId = user.id
and userRef.userName != user.name
</query>
</named-query>
<named-query name="XXPolicyRefUser.findUpdatedUserNamesByService">
<query>select userRef.policyId, userRef.userName, user.name
from XXPolicy policy, XXPolicyRefUser userRef, XXUser user
where policy.service = :service
and userRef.policyId = policy.id
and userRef.userId = user.id
and userRef.userName != user.name
</query>
</named-query>
<named-query name="XXPolicyRefAccessType.findUpdatedAccessNamesByPolicy">
<query>select accessRef.policyId, accessRef.accessTypeName, accessDef.name
from XXPolicyRefAccessType accessRef, XXAccessTypeDef accessDef
where accessRef.policyId = :policy
and accessRef.accessDefId = accessDef.id
and accessRef.accessTypeName != accessDef.name
</query>
</named-query>
<named-query name="XXPolicyRefAccessType.findUpdatedAccessNamesByService">
<query>select accessRef.policyId, accessRef.accessTypeName, accessDef.name
from XXPolicy policy, XXPolicyRefAccessType accessRef, XXAccessTypeDef accessDef
where policy.service = :service
and accessRef.policyId = policy.id
and accessRef.accessDefId = accessDef.id
and accessRef.accessTypeName != accessDef.name
</query>
</named-query>
<named-query name="XXPolicyRefResource.findUpdatedResourceNamesByPolicy">
<query>select resourceRef.policyId, resourceRef.resourceName, resourceDef.name
from XXPolicyRefResource resourceRef, XXResourceDef resourceDef
where resourceRef.policyId = :policy
and resourceRef.resourceDefId = resourceDef.id
and resourceRef.resourceName != resourceDef.name
</query>
</named-query>
<named-query name="XXPolicyRefResource.findUpdatedResourceNamesByService">
<query>select resourceRef.policyId, resourceRef.resourceName, resourceDef.name
from XXPolicy policy, XXPolicyRefResource resourceRef, XXResourceDef resourceDef
where policy.service = :service
and resourceRef.policyId = policy.id
and resourceRef.resourceDefId = resourceDef.id
and resourceRef.resourceName != resourceDef.name
</query>
</named-query>
<named-query name="XXPolicyRefDataMaskType.findUpdatedDataMaskNamesByPolicy">
<query>select dataMaskRef.policyId, dataMaskRef.dataMaskTypeName, dMaskDef.name
from XXPolicyRefDataMaskType dataMaskRef, XXDataMaskTypeDef dMaskDef
where dataMaskRef.policyId = :policy
and dataMaskRef.dataMaskDefId = dMaskDef.id
and dataMaskRef.dataMaskTypeName != dMaskDef.name
</query>
</named-query>
<named-query name="XXPolicyRefDataMaskType.findUpdatedDataMaskNamesByService">
<query>select dataMaskRef.policyId, dataMaskRef.dataMaskTypeName, dMaskDef.name
from XXPolicy policy, XXPolicyRefDataMaskType dataMaskRef, XXDataMaskTypeDef dMaskDef
where policy.service = :service
and dataMaskRef.policyId = policy.id
and dataMaskRef.dataMaskDefId = dMaskDef.id
and dataMaskRef.dataMaskTypeName != dMaskDef.name
</query>
</named-query>
<named-query name="XXPolicyRefCondition.findUpdatedConditionNamesByPolicy">
<query>select conditionRef.policyId, conditionRef.conditionName, condDef.name
from XXPolicyRefCondition conditionRef, XXPolicyConditionDef condDef
where conditionRef.policyId = :policy
and conditionRef.conditionDefId = condDef.id
and conditionRef.conditionName != condDef.name
</query>
</named-query>
<named-query name="XXPolicyRefCondition.findUpdatedConditionNamesByService">
<query>select conditionRef.policyId, conditionRef.conditionName, condDef.name
from XXPolicy policy, XXPolicyRefCondition conditionRef, XXPolicyConditionDef condDef
where policy.service = :service
and conditionRef.policyId = policy.id
and conditionRef.conditionDefId = condDef.id
and conditionRef.conditionName != condDef.name
</query>
</named-query>
<!-- end -->
<!-- XXPolicyRefDataMaskType -->
<named-query name="XXPolicyRefDataMaskType.findByPolicyId">
<query>select obj from XXPolicyRefDataMaskType obj where obj.policyId = :policyId </query>
</named-query>
<named-query name="XXPolicyRefDataMaskType.findByDataMaskTypeName">
<query>select obj from XXPolicyRefDataMaskType obj where obj.dataMaskTypeName = :dataMaskTypeName</query>
</named-query>
<named-query name="XXPolicyRefDataMaskType.deleteByPolicyId">
<query>DELETE FROM XXPolicyRefDataMaskType obj WHERE obj.policyId = :policyId </query>
</named-query>
<!-- XXPolicyRefResource -->
<named-query name="XXPolicyRefResource.findByPolicyId">
<query>select obj from XXPolicyRefResource obj where obj.policyId = :policyId </query>
</named-query>
<named-query name="XXPolicyRefResource.findByResourceDefId">
<query>select obj from XXPolicyRefResource obj where obj.resourceDefId = :resourceDefId</query>
</named-query>
<named-query name="XXPolicyRefResource.deleteByPolicyId">
<query>DELETE FROM XXPolicyRefResource obj WHERE obj.policyId = :policyId </query>
</named-query>
<!-- XXPolicyRefUser -->
<named-query name="XXPolicyRefUser.findByPolicyId">
<query>select obj from XXPolicyRefUser obj where obj.policyId = :policyId </query>
</named-query>
<named-query name="XXPolicyRefUser.findByUserName">
<query>select obj from XXPolicyRefUser obj where obj.userName = :userName</query>
</named-query>
<named-query name="XXPolicyRefUser.findByUserId">
<query>select obj from XXPolicyRefUser obj where obj.userId = :userId</query>
</named-query>
<named-query name="XXPolicyRefUser.deleteByPolicyId">
<query>DELETE FROM XXPolicyRefUser obj WHERE obj.policyId = :policyId</query>
</named-query>
<!-- XXPolicyItemCondition -->
<named-query name="XXPolicyItemCondition.findByPolicyId">
<query>select obj from XXPolicyItemCondition obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId = :policyId
order by obj.policyItemId, obj.type, obj.order
</query>
</named-query>
<named-query name="XXPolicyItemCondition.findByServiceId">
<query>select obj from XXPolicyItemCondition obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)
order by item.policyId, obj.policyItemId, obj.type, obj.order
</query>
</named-query>
<named-query name="XXPolicyItemCondition.deleteByPolicyId">
<query>DELETE FROM XXPolicyItemCondition obj WHERE obj.policyItemId in (select item.id from XXPolicyItem item where item.policyId = :policyId)</query>
</named-query>
<!-- XXPolicyItemGroupPerm -->
<named-query name="XXPolicyItemGroupPerm.findByPolicyId">
<query>select obj from XXPolicyItemGroupPerm obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId = :policyId
order by obj.policyItemId, obj.order
</query>
</named-query>
<named-query name="XXPolicyItemGroupPerm.findByServiceId">
<query>select obj from XXPolicyItemGroupPerm obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)
order by item.policyId, obj.policyItemId, obj.order
</query>
</named-query>
<named-query name="XXPolicyItemGroupPerm.deleteByPolicyId">
<query>DELETE FROM XXPolicyItemGroupPerm obj WHERE obj.policyItemId in (select item.id from XXPolicyItem item where item.policyId = :policyId)</query>
</named-query>
<!-- XXPolicyItemUserPerm -->
<named-query name="XXPolicyItemUserPerm.findByPolicyId">
<query>select obj from XXPolicyItemUserPerm obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId = :policyId
order by obj.policyItemId, obj.order
</query>
</named-query>
<named-query name="XXPolicyItemUserPerm.findByServiceId">
<query>select obj from XXPolicyItemUserPerm obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)
order by item.policyId, obj.policyItemId, obj.order
</query>
</named-query>
<named-query name="XXPolicyItemUserPerm.deleteByPolicyId">
<query>DELETE FROM XXPolicyItemUserPerm obj WHERE obj.policyItemId in (select item.id from XXPolicyItem item where item.policyId = :policyId)</query>
</named-query>
<!-- XXPolicyItemDataMaskInfo -->
<named-query name="XXPolicyItemDataMaskInfo.findByPolicyId">
<query>select obj from XXPolicyItemDataMaskInfo obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId = :policyId
order by obj.policyItemId
</query>
</named-query>
<named-query name="XXPolicyItemDataMaskInfo.findByServiceId">
<query>select obj from XXPolicyItemDataMaskInfo obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)
order by item.policyId, obj.policyItemId
</query>
</named-query>
<named-query name="XXPolicyItemDataMaskInfo.deleteByPolicyId">
<query>DELETE FROM XXPolicyItemDataMaskInfo obj WHERE obj.policyItemId in (select item.id from XXPolicyItem item where item.policyId = :policyId)</query>
</named-query>
<!-- XXPolicyItemRowFilterInfo -->
<named-query name="XXPolicyItemRowFilterInfo.findByPolicyId">
<query>select obj from XXPolicyItemRowFilterInfo obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId = :policyId
order by obj.policyItemId
</query>
</named-query>
<named-query name="XXPolicyItemRowFilterInfo.findByServiceId">
<query>select obj from XXPolicyItemRowFilterInfo obj, XXPolicyItem item
where obj.policyItemId = item.id
and item.policyId in (select policy.id from XXPolicy policy where policy.service = :serviceId)
order by item.policyId, obj.policyItemId
</query>
</named-query>
<named-query name="XXPolicyItemRowFilterInfo.deleteByPolicyId">
<query>DELETE FROM XXPolicyItemRowFilterInfo obj WHERE obj.policyItemId in (select item.id from XXPolicyItem item where item.policyId = :policyId)</query>
</named-query>
<!-- XXDataHist -->
<named-query name="XXDataHist.findLatestByObjectClassTypeAndObjectId">
<query>select obj from XXDataHist obj where obj.objectId = :objectId and obj.objectClassType = :classType</query>
</named-query>
<named-query name="XXDataHist.getVersionListOfObject">
<query>select obj.version from XXDataHist obj where obj.objectId = :objId
and obj.objectClassType = :classType GROUP BY obj.version </query>
</named-query>
<named-query name="XXDataHist.findObjectByVersionNumber">
<query>select obj from XXDataHist obj where obj.objectId = :objId and obj.objectClassType = :classType and obj.version = :version</query>
</named-query>
<!-- XXTrxLog -->
<named-query name="XXTrxLog.findLogForMaxIdOfClassType">
<query>select MAX(obj.objectId) from XXTrxLog obj where obj.objectClassType = :classType</query>
</named-query>
<!-- XXUserPermission -->
<named-query name="XXUserPermission.findByUserPermissionId">
<query>SELECT obj FROM XXUserPermission obj
WHERE obj.userId=:userId
</query>
</named-query>
<named-query name="XXUserPermission.findByUserPermissionIdAndIsAllowed">
<query>SELECT obj FROM XXUserPermission obj
WHERE obj.userId=:userId AND Obj.isAllowed=:isAllowed
</query>
</named-query>
<named-query name="XXUserPermission.findByModuleId">
<query>SELECT obj FROM XXUserPermission obj
WHERE obj.moduleId=:moduleId AND Obj.isAllowed=:isAllowed
</query>
</named-query>
<named-query name="XXUserPermissionUpdates.findByModuleId">
<query>SELECT obj FROM XXUserPermission obj
WHERE obj.moduleId=:moduleId
</query>
</named-query>
<named-query name="XXUserPermission.deleteByModuleId">
<query>DELETE FROM XXUserPermission obj WHERE obj.moduleId=:moduleId</query>
</named-query>
<!-- XXGroupPermission -->
<named-query name="XXGroupPermission.findByGroupId">
<query>SELECT obj FROM XXGroupPermission obj
WHERE obj.groupId=:groupId
</query>
</named-query>
<named-query name="XXGroupPermission.findByModuleId">
<query>SELECT obj FROM XXGroupPermission obj
WHERE obj.moduleId=:moduleId AND Obj.isAllowed=:isAllowed
</query>
</named-query>
<named-query name="XXGroupPermissionUpdates.findByModuleId">
<query>SELECT obj FROM XXGroupPermission obj
WHERE obj.moduleId=:moduleId AND Obj.isAllowed=:isAllowed
</query>
</named-query>
<named-query name="XXGroupPermissionUpdate.findByModuleId">
<query>SELECT obj FROM XXGroupPermission obj
WHERE obj.moduleId=:moduleId
</query>
</named-query>
<named-query name="XXUserPermission.findByModuleIdAndPortalUserId">
<query>SELECT XXUserPermObj
FROM XXUserPermission XXUserPermObj
WHERE XXUserPermObj.moduleId = :moduleId AND XXUserPermObj.userId =:userId
</query>
</named-query>
<named-query name="XXGroupPermission.findByModuleIdAndGroupId">
<query>SELECT obj FROM XXGroupPermission obj WHERE obj.moduleId = :moduleId AND obj.groupId =:groupId
</query>
</named-query>
<named-query name="XXGroupPermission.deleteByModuleId">
<query>DELETE FROM XXGroupPermission obj WHERE obj.moduleId=:moduleId</query>
</named-query>
<named-query name="XXPortalUser.findByUserName">
<query>SELECT Obj FROM XXPortalUser obj
WHERE obj.loginId=:loginId
</query>
</named-query>
<named-query name="XXPortalUser.findByXUserId">
<query>SELECT xxPortalUser FROM XXPortalUser xxPortalUser,XXUser xxUser
WHERE xxUser.id=:id and xxPortalUser.loginId=xxUser.name
</query>
</named-query>
<named-query name="XXPortalUser.findAllXPortalUser">
<query>SELECT xxPortalUser FROM XXPortalUser xxPortalUser
</query>
</named-query>
<!-- VXModuleDef -->
<named-query name="XXModuleDef.findByModuleId">
<query>SELECT obj FROM XXModuleDef obj
WHERE obj.id=:id
</query>
</named-query>
<named-query name="XXModuleDef.findByModuleName">
<query>SELECT Obj FROM XXModuleDef obj
WHERE obj.module=:moduleName
</query>
</named-query>
<named-query name="XXModuleDef.findAllAccessibleModulesByUserId">
<query>SELECT obj.module FROM XXModuleDef obj
WHERE obj.id in (SELECT userPerm.moduleId FROM XXUserPermission userPerm WHERE userPerm.userId=:portalUserId and userPerm.isAllowed=:isAllowed)
OR obj.id in (SELECT grpPerm.moduleId FROM XXGroupPermission grpPerm WHERE
grpPerm.groupId IN (SELECT grpUser.parentGroupId FROM XXGroupUser grpUser WHERE grpUser.userId=:xUserId) and grpPerm.isAllowed=:isAllowed)
</query>
</named-query>
<named-query name="XXModuleDef.findAccessibleModulesByGroupId">
<query>select obj.module from XXModuleDef obj, XXGroupPermission grpPerm where
grpPerm.groupId IN :grpIdList and grpPerm.moduleId = obj.id and grpPerm.isAllowed = :isAllowed
</query>
</named-query>
<named-query name="XXGroupPermission.findByVXPoratUserId">
<query>SELECT distinct gmp FROM XXGroupUser xgu,XXUser xu,XXGroupPermission gmp, XXPortalUser xpu
WHERE xu.name=xpu.loginId and xu.id=xgu.userId and xgu.parentGroupId=gmp.groupId and
xpu.id=:userId and gmp.isAllowed=:isAllowed
</query>
</named-query>
<!-- Start ==> JPA Queries for Tag Based Policies -->
<named-query name="XXServiceResourceElement.findByResourceId">
<query>select obj from XXServiceResourceElement obj where obj.resourceId = :resourceId order by obj.resourceId, obj.id</query>
</named-query>
<named-query name="XXServiceResourceElement.findTaggedResourcesInServiceId">
<query>select obj from XXServiceResourceElement obj where obj.resourceId in
(select serviceresource.id from XXServiceResource serviceresource where serviceresource.serviceId = :serviceId and serviceresource.id in
(select tagResMap.resourceId from XXTagResourceMap tagResMap)
)
order by obj.resourceId, obj.id
</query>
</named-query>
<named-query name="XXServiceResourceElement.findByServiceId">
<query>select obj from XXServiceResourceElement obj where obj.resourceId in
(select serviceresource.id from XXServiceResource serviceresource where serviceresource.serviceId = :serviceId)
order by obj.resourceId, obj.id
</query>
</named-query>
<named-query name="XXServiceResourceElementValue.findByResElementId">
<query>select obj from XXServiceResourceElementValue obj where obj.resElementId = :resElementId</query>
</named-query>
<named-query name="XXServiceResourceElementValue.findValuesByResElementId">
<query>select obj.value from XXServiceResourceElementValue obj where obj.resElementId = :resElementId</query>
</named-query>
<named-query name="XXServiceResourceElementValue.findTaggedResourcesInServiceId">
<query>select obj from XXServiceResourceElementValue obj, XXServiceResourceElement resElem where obj.resElementId = resElem.id and resElem.resourceId in
(select res.id from XXServiceResource res where res.serviceId = :serviceId and res.id in
(select tagResMap.resourceId from XXTagResourceMap tagResMap)
)
order by resElem.resourceId, resElem.id
</query>
</named-query>
<named-query name="XXServiceResourceElementValue.findByServiceId">
<query>select obj from XXServiceResourceElementValue obj, XXServiceResourceElement resElem where obj.resElementId = resElem.id and resElem.resourceId in
(select res.id from XXServiceResource res where res.serviceId = :serviceId)
order by resElem.resourceId, resElem.id
</query>
</named-query>
<named-query name="XXServiceResourceElementValue.findByResourceId">
<query>select obj from XXServiceResourceElementValue obj, XXServiceResourceElement resElem where obj.resElementId = resElem.id and resElem.resourceId = :resourceId
order by resElem.resourceId, resElem.id
</query>
</named-query>
<named-query name="XXTagResourceMap.findByGuid">
<query>select obj from XXTagResourceMap obj where obj.guid = :guid</query>
</named-query>
<named-query name="XXTagResourceMap.findByResourceId">
<query>select obj from XXTagResourceMap obj where obj.resourceId = :resourceId</query>
</named-query>
<named-query name="XXTagResourceMap.findByResourceGuid">
<query>select obj from XXTagResourceMap obj, XXServiceResource res where res.guid = :resourceGuid and obj.resourceId = res.id</query>
</named-query>
<named-query name="XXTagResourceMap.findByTagId">
<query>select obj from XXTagResourceMap obj where obj.tagId = :tagId</query>
</named-query>
<named-query name="XXTagResourceMap.findByTagGuid">
<query>select obj from XXTagResourceMap obj, XXTag tag where tag.guid = :tagGuid and obj.tagId = tag.id</query>
</named-query>
<named-query name="XXTagResourceMap.findByTagAndResourceId">
<query>select obj from XXTagResourceMap obj where obj.resourceId = :resourceId and obj.tagId = :tagId</query>
</named-query>
<named-query name="XXTagResourceMap.findByTagAndResourceGuid">
<query>select obj from XXTagResourceMap obj, XXTag tag, XXServiceResource res where tag.guid = :tagGuid and res.guid = :resourceGuid and obj.tagId = tag.id and obj.resourceId = res.id</query>
</named-query>
<named-query name="XXTagResourceMap.findByServiceId">
<query>select obj from XXTagResourceMap obj, XXServiceResource res
where obj.resourceId = res.id and res.serviceId = :serviceId
order by obj.resourceId</query>
</named-query>
<named-query name="XXTagResourceMap.getTagIdsForResourceId">
<query>select obj.tagId from XXTagResourceMap obj
where obj.resourceId = :resourceId order by obj.id
</query>
</named-query>
<named-query name="XXTagDef.findByGuid">
<query>select obj from XXTagDef obj where obj.guid = :guid</query>
</named-query>
<named-query name="XXTagDef.findByName">
<query>select obj from XXTagDef obj where obj.name = :name</query>
</named-query>
<named-query name="XXTagDef.findByServiceId">
<query>select obj.id, obj.guid, obj.version, obj.isEnabled, obj.name, obj.source, obj.tagAttrDefs from XXTagDef obj where obj.id in
(select tag.type from XXTag tag, XXTagResourceMap tagRes, XXServiceResource resource where tag.id = tagRes.tagId and tagRes.resourceId = resource.id and resource.serviceId = :serviceId)
order by obj.id
</query>
</named-query>
<named-query name="XXTagDef.findByResourceId">
<query>select obj from XXTagDef obj where obj.id in
(select tag.type from XXTag tag, XXTagResourceMap tagRes where tag.id = tagRes.tagId and tagRes.resourceId = :resourceId)
order by obj.id
</query>
</named-query>
<named-query name="XXTagDef.getAllNames">
<query>select obj.name from XXTagDef obj</query>
</named-query>
<named-query name="XXTagAttributeDef.findByTagDefId">
<query>select obj from XXTagAttributeDef obj where obj.tagDefId = :tagDefId</query>
</named-query>
<named-query name="XXTagAttributeDef.findByServiceId">
<query>select obj from XXTagAttributeDef obj where obj.tagDefId in
(select tag.type from XXTag tag, XXTagResourceMap tagRes, XXServiceResource resource where tag.id = tagRes.tagId and tagRes.resourceId = resource.id and resource.serviceId = :serviceId)
order by obj.tagDefId
</query>
</named-query>
<named-query name="XXTagAttributeDef.findByResourceId">
<query>select obj from XXTagAttributeDef obj where obj.tagDefId in
(select tag.type from XXTag tag, XXTagResourceMap tagRes where tag.id = tagRes.tagId and tagRes.resourceId = :resourceId)
order by obj.tagDefId
</query>
</named-query>
<named-query name="XXTag.findByGuid">
<query>select obj from XXTag obj where obj.guid = :guid order by obj.id</query>
</named-query>
<named-query name="XXTag.findByName">
<query>select obj from XXTag obj, XXTagDef tagDef where obj.type = tagDef.id and tagDef.name = :name</query>
</named-query>
<named-query name="XXTag.findByResourceId">
<query>select obj from XXTag obj, XXTagResourceMap tagResMap where tagResMap.resourceId = :resourceId and obj.id = tagResMap.tagId order by obj.id</query>
</named-query>
<named-query name="XXTag.findByResourceGuid">
<query>select obj from XXTag obj, XXTagResourceMap tagRes, XXServiceResource res where res.guid = :resourceGuid and res.id = tagRes.resourceId and tagRes.tagId = obj.id</query>
</named-query>
<named-query name="XXTag.findTagTypesByServiceId">
<query>select obj.name from XXTagDef obj, XXTag tag, XXServiceResource resource, XXTagResourceMap tagRes
where obj.id = tag.type and tag.id = tagRes.tagId and tagRes.resourceId = resource.id and resource.serviceId = :serviceId</query>
</named-query>
<named-query name="XXTag.findByServiceId">
<query>select obj from XXTag obj where obj.id in
(select tagRes.tagId from XXTagResourceMap tagRes, XXServiceResource resource where tagRes.resourceId = resource.id and resource.serviceId = :serviceId)
order by obj.id
</query>
</named-query>
<named-query name="XXTag.findByServiceIdAndOwner">
<query>select obj from XXTag obj where obj.owner = :owner and obj.id in
(select tagRes.tagId from XXTagResourceMap tagRes, XXServiceResource resource where tagRes.resourceId = resource.id and resource.serviceId = :serviceId)
order by obj.id
</query>
</named-query>
<named-query name="XXTagAttribute.findByTagId">
<query>select obj from XXTagAttribute obj where obj.tagId = :tagId</query>
</named-query>
<named-query name="XXTagAttribute.findByServiceId">
<query>select obj from XXTagAttribute obj where obj.tagId in
(select tagRes.tagId from XXTagResourceMap tagRes, XXServiceResource resource where tagRes.resourceId = resource.id and resource.serviceId = :serviceId)
order by obj.tagId
</query>
</named-query>
<named-query name="XXTagAttribute.findByServiceIdAndOwner">
<query>select obj from XXTagAttribute obj where obj.tagId in
(select tag.id from XXTag tag where tag.owner = :owner and tag.id in
(select tagRes.tagId from XXTagResourceMap tagRes, XXServiceResource resource where tagRes.resourceId = resource.id and resource.serviceId = :serviceId)
)
order by obj.tagId
</query>
</named-query>
<named-query name="XXTagAttribute.findByResourceId">
<query>select obj from XXTagAttribute obj where obj.tagId in
(select tagRes.tagId from XXTagResourceMap tagRes where tagRes.resourceId = :resourceId)
order by obj.tagId
</query>
</named-query>
<named-query name="XXServiceResource.findByGuid">
<query>select obj from XXServiceResource obj where obj.guid = :guid</query>
</named-query>
<named-query name="XXServiceResource.findByServiceId">
<query>select obj from XXServiceResource obj where obj.serviceId = :serviceId
order by obj.id
</query>
</named-query>
<named-query name="XXServiceResource.findTaggedResourcesInServiceId">
<query>select obj.id, obj.guid, obj.version, obj.isEnabled, obj.resourceSignature, obj.serviceId, obj.serviceResourceElements, obj.tags from XXServiceResource obj where obj.serviceId = :serviceId and obj.id in
(select tagResMap.resourceId from XXTagResourceMap tagResMap)
order by obj.id
</query>
</named-query>
<named-query name="XXServiceResource.countTaggedResourcesInServiceId">
<query>select count(obj.id) from XXServiceResource obj where obj.serviceId = :serviceId and obj.id in
(select tagResMap.resourceId from XXTagResourceMap tagResMap)
</query>
</named-query>
<named-query name="XXServiceResource.findByServiceAndResourceSignature">
<query>select obj from XXServiceResource obj where obj.serviceId = :serviceId and obj.resourceSignature = :resourceSignature</query>
</named-query>
<named-query name="XXServiceResource.findServiceResourceGuidsInServiceId">
<query>select obj.guid from XXServiceResource obj where obj.serviceId = :serviceId</query>
</named-query>
<!-- End <== JPA Queries for Tag Based Policies -->
<named-query name="XXTrxLog.getMaxIdOfXXTrxLog">
<query>select max(obj.id) from XXTrxLog obj</query>
</named-query>
<named-query name="XXTrxLog.updateLogAttr">
<query>UPDATE XXTrxLog obj SET obj.newValue = :newValue
WHERE obj.id &gt; :idFrom
AND obj.id &lt; :idTo
AND obj.objectClassType = :objClassType
AND obj.attributeName = :attrName
</query>
</named-query>
<named-query name="XXAuthSession.getAuthSessionByUserId">
<query>SELECT obj FROM XXAuthSession obj WHERE obj.userId = :userId
</query>
</named-query>
<named-query name="XXGroupGroup.findByGroupId">
<query>SELECT obj FROM XXGroupGroup obj WHERE obj.groupId = :groupId or obj.parentGroupId = :parentGroupId
</query>
</named-query>
<named-query name="XXPolicy.findByUserId">
<query>select obj from XXPolicy obj, XXPolicyRefUser ref where
obj.id = ref.policyId and ref.userId = :userId</query>
</named-query>
<named-query name="XXPolicy.findByGroupId">
<query>select obj from XXPolicy obj, XXPolicyRefGroup ref where
obj.id = ref.policyId and ref.groupId = :groupId</query>
</named-query>
<named-query name="XXAccessAudit.getMaxIdOfXXAccessAudit">
<query>select max(obj.id) from XXAccessAudit obj</query>
</named-query>
<named-query name="XXAccessAuditV4.getByIdRangeV4">
<query>select obj from XXAccessAuditV4 obj WHERE obj.id &gt; :idFrom AND obj.id &lt; :idTo</query>
</named-query>
<named-query name="XXAccessAuditV5.getByIdRangeV5">
<query>select obj from XXAccessAuditV5 obj WHERE obj.id &gt; :idFrom AND obj.id &lt; :idTo</query>
</named-query>
<named-query name="XXAccessAudit.getByIdRangeV6">
<query>select obj from XXAccessAudit obj WHERE obj.id &gt; :idFrom AND obj.id &lt; :idTo</query>
</named-query>
<named-query name="XXDataHist.findLatestByObjectClassTypeAndObjectIdAndEventTime">
<query>select obj from XXDataHist obj where obj.objectId = :objectId and
obj.objectClassType = :classType and
obj.createTime &lt;= :createTime ORDER BY obj.id DESC</query>
</named-query>
<named-query name="XXPortalUserRole.findXPortalUserRolebyXPortalUserId">
<query>select obj.userRole from XXPortalUserRole obj where obj.userId = :userId</query>
</named-query>
<!-- XXPluginInfo -->
<named-query name="XXPluginInfo.find">
<query>
select obj from XXPluginInfo obj where obj.serviceName = :serviceName and obj.appType = :appType and obj.hostName = :hostName
</query>
</named-query>
<named-query name="XXPluginInfo.findByServiceName">
<query>
select obj from XXPluginInfo obj where obj.serviceName = :serviceName
</query>
</named-query>
<named-query name="XXPluginInfo.findByServiceId">
<query>
select obj from XXPluginInfo obj, XXService service where obj.serviceName = service.name and service.id = :serviceId
</query>
</named-query>
<named-query name="XXPluginInfo.findByServiceAndHostName">
<query>
select obj from XXPluginInfo obj where obj.serviceName = :serviceName and obj.hostName = :hostName
</query>
</named-query>
<!-- XXUgsyncAuditInfo -->
<named-query name="XXUgsyncAuditInfo.findBySessionId">
<query>
select obj from XXUgsyncAuditInfo obj where obj.sessionId = :sessionId
</query>
</named-query>
<named-query name="XXUgsyncAuditInfo.findBySyncSource">
<query>
select obj from XXUgsyncAuditInfo obj where obj.syncSource = :syncSource
</query>
</named-query>
<!-- SecurityZone -->
<named-query name="XXSecurityZone.findByZoneId">
<query>
select obj from XXSecurityZone obj where obj.id = :zoneId
</query>
</named-query>
<named-query name="XXSecurityZone.findByZoneName">
<query>
select obj from XXSecurityZone obj where obj.name = :zoneName
</query>
</named-query>
<named-query name="XXSecurityZone.findByServiceName">
<query>
select obj.name from XXSecurityZone obj where obj.id in (select ref.zoneId from XXSecurityZoneRefService ref where ref.serviceName = :serviceName)
</query>
</named-query>
<named-query name="XXSecurityZone.findByTagServiceName">
<query>
select obj.name from XXSecurityZone obj where obj.id in (select ref.zoneId from XXSecurityZoneRefTagService ref where ref.tagServiceName = :tagServiceName)
</query>
</named-query>
<named-query name="XXSecurityZoneRefGroup.findByZoneId">
<query>
select obj from XXSecurityZoneRefGroup obj where obj.zoneId = :zoneId
</query>
</named-query>
<named-query name="XXSecurityZoneRefGroup.findByGroupId">
<query>
select obj from XXSecurityZoneRefGroup obj where obj.groupId = :groupId
</query>
</named-query>
<named-query name="XXSecurityZoneRefGroup.findGroupTypeByZoneId">
<query>
select obj from XXSecurityZoneRefGroup obj where obj.zoneId = :zoneId and obj.groupType = :groupType
</query>
</named-query>
<named-query name="XXSecurityZoneRefResource.findByZoneId">
<query>
select obj from XXSecurityZoneRefResource obj where obj.zoneId = :zoneId
</query>
</named-query>
<named-query name="XXSecurityZoneRefResource.findByResourceDefId">
<query>
select obj from XXSecurityZoneRefResource obj where obj.resourceDefId = :resourceDefId
</query>
</named-query>
<named-query name="XXSecurityZoneRefService.findByZoneId">
<query>
select obj from XXSecurityZoneRefService obj where obj.zoneId = :zoneId
</query>
</named-query>
<named-query name="XXSecurityZoneRefService.findByServiceId">
<query>
select obj from XXSecurityZoneRefService obj where obj.serviceId = :serviceId
</query>
</named-query>
<named-query name="XXSecurityZoneRefService.findByServiceName">
<query>
select obj from XXSecurityZoneRefService obj where obj.serviceName = :serviceName
</query>
</named-query>
<named-query name="XXSecurityZoneRefService.findByServiceNameAndZoneId">
<query>
select obj from XXSecurityZoneRefService obj where obj.serviceName = :serviceName and obj.zoneId = :zoneId
</query>
</named-query>
<named-query name="XXSecurityZoneRefTagService.findByZoneId">
<query>
select obj from XXSecurityZoneRefTagService obj where obj.zoneId = :zoneId
</query>
</named-query>
<named-query name="XXSecurityZoneRefTagService.findByTagServiceNameAndZoneId">
<query>
select obj from XXSecurityZoneRefTagService obj where obj.tagServiceName = :tagServiceName and obj.zoneId = :zoneId
</query>
</named-query>
<named-query name="XXSecurityZoneRefUser.findByZoneId">
<query>
select obj from XXSecurityZoneRefUser obj where obj.zoneId = :zoneId
</query>
</named-query>
<named-query name="XXSecurityZoneRefUser.findByUserId">
<query>
select obj from XXSecurityZoneRefUser obj where obj.userId = :userId
</query>
</named-query>
<named-query name="XXSecurityZoneRefUser.findUserTypeByZoneId">
<query>
select obj from XXSecurityZoneRefUser obj where obj.zoneId = :zoneId and obj.userType = :userType
</query>
</named-query>
<named-query name="XXSecurityZone.findZoneNamesByUserId">
<query>
select distinct obj.name from XXSecurityZone obj, XXSecurityZoneRefUser refObj where obj.id = refObj.zoneId and refObj.userId = :userId
</query>
</named-query>
<named-query name="XXSecurityZone.findZoneNamesByGroupId">
<query>
select distinct obj.name from XXSecurityZone obj, XXSecurityZoneRefGroup refObj where obj.id = refObj.zoneId and refObj.groupId = :groupId
</query>
</named-query>
<named-query name="XXGlobalState.findByStateId">
<query>
select obj from XXGlobalState obj where obj.id = :stateId
</query>
</named-query>
<named-query name="XXGlobalState.findByStateName">
<query>
select obj from XXGlobalState obj where obj.stateName = :stateName
</query>
</named-query>
<!-- XXPolicyChangeLog -->
<named-query name="XXPolicyChangeLog.findByServiceId">
<query>
select obj from XXPolicyChangeLog obj where obj.serviceId = :serviceId
</query>
</named-query>
<named-query name="XXPolicyChangeLog.findSinceVersion">
<query>
select obj.id, obj.changeType, obj.policyVersion, obj.serviceType, obj.policyType, obj.policyId, obj.zoneName from
XXPolicyChangeLog obj where obj.serviceId = :serviceId and obj.policyVersion >= :version order by
obj.policyVersion
</query>
</named-query>
<named-query name="XXPolicyChangeLog.findGreaterThan">
<query>
select obj.id, obj.changeType, obj.policyVersion, obj.serviceType, obj.policyType, obj.policyId, obj.zoneName from
XXPolicyChangeLog obj where obj.serviceId = :serviceId and obj.serviceType = 'tag' and obj.id > :id order by obj.id
</query>
</named-query>
<named-query name="XXPolicyChangeLog.deleteOlderThan">
<query>delete from XXPolicyChangeLog obj where obj.createTime &lt; :olderThan</query>
</named-query>
<!-- XXRole -->
<named-query name="XXRole.findByRoleId">
<query>select obj from XXRole obj where obj.id = :roleId</query>
</named-query>
<named-query name="XXRole.findByRoleName">
<query>select obj from XXRole obj where obj.name = :roleName</query>
</named-query>
<named-query name="XXRole.findByServiceId">
<query>select obj from XXRole obj, XXPolicyRefRole policyRefRole, XXPolicy policy where obj.id = policyRefRole.roleId and policyRefRole.policyId = policy.id and policy.service = :serviceId </query>
</named-query>
<named-query name="XXRole.findRoleNamesByServiceId">
<query>select obj.name from XXRole obj, XXPolicyRefRole policyRefRole, XXPolicy policy where obj.id = policyRefRole.roleId and policyRefRole.policyId = policy.id and policy.service = :serviceId </query>
</named-query>
<named-query name="XXRole.getAllNames">
<query>select obj.name from XXRole obj</query>
</named-query>
<!-- XXRoleRef* -->
<named-query name="XXRoleRefUser.findByRoleId">
<query>select obj from XXRoleRefUser obj where obj.roleId = :roleId</query>
</named-query>
<named-query name="XXRoleRefUser.findByUserId">
<query>select obj from XXRoleRefUser obj where obj.userId = :userId</query>
</named-query>
<named-query name="XXRoleRefUser.findByUserName">
<query>select obj from XXRoleRefUser obj where obj.userName = :userName</query>
</named-query>
<named-query name="XXRoleRefGroup.findByRoleId">
<query>select obj from XXRoleRefGroup obj where obj.roleId = :roleId</query>
</named-query>
<named-query name="XXRoleRefGroup.findByGroupId">
<query>select obj from XXRoleRefGroup obj where obj.groupId = :groupId</query>
</named-query>
<named-query name="XXRoleRefGroup.findByGroupName">
<query>select obj from XXRoleRefGroup obj where obj.groupName = :groupName </query>
</named-query>
<named-query name="XXRoleRefRole.findByRoleId">
<query>select obj from XXRoleRefRole obj where obj.roleId = :roleId</query>
</named-query>
<named-query name="XXRoleRefRole.findBySubRoleId">
<query>select obj from XXRoleRefRole obj where obj.subRoleId = :subRoleId</query>
</named-query>
<named-query name="XXRoleRefRole.findBySubRoleName">
<query>select obj from XXRoleRefRole obj where obj.subRoleName = :subRoleName </query>
</named-query>
<named-query name="XXRoleRefRole.findRoleRefRoleCount">
<query>select count(obj.roleId) from XXRoleRefRole obj where obj.subRoleName = :subRoleName </query>
</named-query>
<!-- XXPolicyRefRole -->
<named-query name="XXPolicyRefRole.findByPolicyId">
<query>select obj from XXPolicyRefRole obj where obj.policyId = :policyId </query>
</named-query>
<named-query name="XXPolicyRefRole.findByRoleName">
<query>select obj from XXPolicyRefRole obj where obj.roleName = :roleName</query>
</named-query>
<named-query name="XXPolicyRefRole.findUpdatedRoleNamesByPolicy">
<query>select roleRef.policyId, roleRef.roleName, role.name
from XXPolicyRefRole roleRef, XXRole role
where roleRef.policyId = :policy
and roleRef.roleId = role.id
and roleRef.roleName != role.name
</query>
</named-query>
<named-query name="XXPolicyRefRole.findUpdatedRoleNamesByService">
<query>select roleRef.policyId, roleRef.roleName, role.name
from XXPolicy policy, XXPolicyRefRole roleRef, XXRole role
where policy.service = :service
and roleRef.policyId = policy.id
and roleRef.roleId = role.id
and roleRef.roleName != role.name
</query>
</named-query>
<named-query name="XXPolicyRefRole.findRoleRefPolicyCount">
<query>select count(obj.policyId) from XXPolicyRefRole obj where obj.roleName = :roleName </query>
</named-query>
<named-query name="XXPolicyRefRole.deleteByPolicyId">
<query>DELETE FROM XXPolicyRefRole obj WHERE obj.policyId = :policyId </query>
</named-query>
<!-- XXTagChangeLog -->
<named-query name="XXTagChangeLog.findSinceVersion">
<query>
select obj.id, obj.changeType, obj.serviceTagsVersion, obj.serviceResourceId, obj.tagId from
XXTagChangeLog obj where obj.serviceId = :serviceId and obj.serviceTagsVersion >= :version order by
obj.serviceTagsVersion
</query>
</named-query>
<named-query name="XXTagChangeLog.deleteOlderThan">
<query>delete from XXTagChangeLog obj where obj.createTime &lt; :olderThan</query>
</named-query>
<!-- RMS queries -->
<named-query name="XXRMSResourceMapping.deleteByHlResourceId">
<query>DELETE FROM XXRMSResourceMapping obj WHERE obj.hlResourceId = :resourceId
</query>
</named-query>
<named-query name="XXRMSResourceMapping.deleteByLlResourceId">
<query>DELETE FROM XXRMSResourceMapping obj WHERE obj.llResourceId = :resourceId
</query>
</named-query>
<named-query name="XXRMSResourceMapping.findByHlAndLlResourceId">
<query>SELECT obj FROM XXRMSResourceMapping obj WHERE obj.hlResourceId = :hlResourceId and obj.llResourceId = :llResourceId
</query>
</named-query>
<named-query name="XXRMSResourceMapping.deleteByHlAndLlResourceId">
<query>DELETE FROM XXRMSResourceMapping obj WHERE obj.hlResourceId = :hlResourceId and obj.llResourceId = :llResourceId
</query>
</named-query>
<named-query name="XXRMSResourceMapping.deleteByLlOrHlResourceId">
<query>DELETE FROM XXRMSResourceMapping obj WHERE obj.hlResourceId = :resourceId or obj.llResourceId = :resourceId
</query>
</named-query>
<named-query name="XXRMSResourceMapping.findByHlResourceId">
<query>SELECT obj.llResourceId FROM XXRMSResourceMapping obj WHERE obj.hlResourceId = :hlResourceId
</query>
</named-query>
<named-query name="XXRMSResourceMapping.findByLlResourceId">
<query>SELECT obj.hlResourceId FROM XXRMSResourceMapping obj WHERE obj.llResourceId = :llResourceId
</query>
</named-query>
<named-query name="XXRMSResourceMapping.getServiceResourcesByLlResourceId">
<query>SELECT obj.id, obj.guid, obj.version, obj.isEnabled, obj.resourceSignature, obj.serviceId, obj.serviceResourceElements FROM XXRMSServiceResource obj where obj.id in (select mapping.hlResourceId FROM XXRMSResourceMapping mapping WHERE mapping.llResourceId = :llResourceId)
</query>
</named-query>
<named-query name="XXRMSResourceMapping.deleteByServiceId">
<query>
DELETE FROM XXRMSResourceMapping mapping WHERE mapping.hlResourceId in (select obj.id from XXRMSServiceResource obj where obj.serviceId = :serviceId) OR
mapping.llResourceId in (select obj.id from XXRMSServiceResource obj where obj.serviceId = :serviceId)
</query>
</named-query>
<named-query name="XXRMSNotification.getMaxIdOfNotifications">
<query>select max(obj.notificationId) from XXRMSNotification obj where obj.llServiceId = :llServiceId and obj.hlServiceId = :hlServiceId</query>
</named-query>
<named-query name="XXRMSNotification.getAllAfterNotificationId">
<query>select obj from XXRMSNotification obj where obj.llServiceId = :llServiceId and obj.hlServiceId = :hlServiceId and obj.notificationId &gt; :notificationId order by obj.notificationId
</query>
</named-query>
<named-query name="XXRMSNotification.getNotificationWithTypeAfterNotificationId">
<query>select obj from XXRMSNotification obj where obj.changeType = :changeType and obj.llServiceId = :llServiceId and obj.hlServiceId = :hlServiceId and obj.notificationId &gt; :notificationId order by obj.notificationId
</query>
</named-query>
<named-query name="XXRMSNotification.getDeletedNotificationsByHlResourceId">
<query>select obj from XXRMSNotification obj where obj.changeType = 'delete' and obj.hlResourceId = :hlResourceId and obj.notificationId &gt; :lastKnownVersion order by obj.notificationId
</query>
</named-query>
<named-query name="XXRMSNotification.deleteByServiceId">
<query>DELETE from XXRMSNotification obj where obj.llServiceId = :serviceId or obj.hlServiceId = :serviceId</query>
</named-query>
<named-query name="XXRMSServiceResource.getLlResourceIdForHlResourceId">
<query>select obj from XXRMSServiceResource obj, XXRMSNotification notification where obj.id = notification.llResourceId and
notification.changeType = 'add' and notification.hlResourceId = :hlResourceId and notification.notificationId > :lastKnownIndex
</query>
</named-query>
<named-query name="XXRMSServiceResource.findByServiceId">
<query>SELECT obj.id, obj.guid, obj.version, obj.isEnabled, obj.resourceSignature, obj.serviceId, obj.serviceResourceElements FROM XXRMSServiceResource obj where obj.serviceId = :serviceId
order by obj.id
</query>
</named-query>
<named-query name="XXRMSServiceResource.getByServiceId">
<query>select obj.id from XXRMSServiceResource obj where obj.serviceId = :serviceId
order by obj.id
</query>
</named-query>
<named-query name="XXRMSServiceResource.deleteByServiceId">
<query>delete from XXRMSServiceResource obj where obj.serviceId = :serviceId</query>
</named-query>
<named-query name="XXRMSServiceResource.findByServiceAndResourceSignature">
<query>select obj from XXRMSServiceResource obj where obj.serviceId = :serviceId and obj.resourceSignature = :resourceSignature</query>
</named-query>
<named-query name="XXRMSServiceResource.deleteById">
<query>DELETE FROM XXRMSServiceResource obj WHERE obj.id = :resourceId
</query>
</named-query>
<named-query name="XXRMSMappingProvider.findByName">
<query>select obj from XXRMSMappingProvider obj where obj.name = :name</query>
</named-query>
<named-query name="XXRole.findByUserId">
<query>SELECT obj FROM XXRole obj
WHERE obj.id IN (SELECT roleRefUser.roleId FROM XXRoleRefUser roleRefUser WHERE roleRefUser.userId = :userId)
OR obj.id IN (SELECT roleRefGroup.roleId FROM XXRoleRefGroup roleRefGroup WHERE roleRefGroup.groupId IN
(SELECT groupUser.parentGroupId FROM XXGroupUser groupUser WHERE groupUser.userId = :userId))
order by obj.id
</query>
</named-query>
</entity-mappings>