-->
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: strange behaviour with native SQL and addentity
PostPosted: Thu Nov 25, 2010 1:09 pm 
Newbie

Joined: Thu Nov 25, 2010 12:23 pm
Posts: 1
hey guys.

i've got a strange behaviour with my native SQL-Query.
What i want: i don't want to map scalar results afterwards in a for loop, instead i try
to determine the objects in my query through addentity (see query below). well, it nearly works. i get my objects (user, permission, orgunit) and i can access their attributes and all (works right too). the only thing that makes me mad is, user , permission and orgunit hava all the same IDs. I checked with the database. The ID from User is right but Permission and Orgunit don't have the right ones. They have the ID's from User.
I also executed the query in mysql-console. the query itself works... Any Ideas? Maybe the failure is obvious...;)

List<Object[]> list1 = session.createSQLQuery("select user.id,user.email, user.firstname,user.lastname,user.passwordsha1,user.username,user.usertype , permission.id, permission.name, orgunit.id, orgunit.full_name, orgunit.name,orgunit.hierarchy_id,orgunit.parent_id from " +
"(((user_orgunit natural join user_permission ) join user on user_id=user.id) join permission on permission_id = permission.id) join orgunit on orgunit.id = orgunit_id where permission.name in (:null)").addEntity(User.class).addEntity(Permission.class).addEntity(OrgUnit.class).setParameterList("null", nullValues).list();


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.