-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: creating alias for same entity in criteria query
PostPosted: Wed Sep 11, 2013 4:17 am 
Newbie

Joined: Wed Sep 11, 2013 3:29 am
Posts: 1
Hi,
Can I create an alias for the root entity for criteria and use it query. I am trying to achieve like following query:

select distinct(rp.roleId) from rolepermission rp, rolepermission rp1 where rp.roleId=? and (rp.permissionId=rp1.permissionId and rp.moduleId = rp1.moduleId);

session.createCriteria(RolePermissionsEntity.class,"rp").createAlias("RolePermissionsEntity","rp1").add(Restrictions.neProperty("rp1.resourceId","rp.resourceId")).add(Restrictions.neProperty("rp1.permissionId","rp.permissionId")).add(Restrictions.eq("rp1.roleId",200));


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.