-->
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.  [ 2 posts ] 
Author Message
 Post subject: how to construct criteria when there is no User table?
PostPosted: Tue Oct 07, 2008 5:11 pm 
Newbie

Joined: Tue Oct 07, 2008 12:17 pm
Posts: 13
Hello everyone..! I'm new to Hibernate.
I've some queries in constructing Criteria instance with the following conditions.

I've 3 tables.
1. APPLICATION (APPLICATION_ID, NAME, CODE);
2. TOKEN ( TOKEN_ID, NAME, COMMENTS, APPLICATION_ID);
3. TOKENUSER( TOKEN_ID (integer), USER_ID(varchar));

I need to construct a criteria instance for the below query.

SELECT A.TOKENID TOKENID, A.COMMENTS
COMMENTS, A.NAME TOKENNAME, C.CODE CODE
FROM TOKEN A, TOKENUSER B, APPLICATION C
WHERE
A.APPLICATION_ID = C.APPLICATION_ID
AND A.TOKEN_ID =B.TOKEN_ID
AND LOWER(B.USER_NAME) = 'jack' AND
LOWER(C.CODE) = 'mars';

Criteria Object:
-------------------
Criteria criteria = session.createCriteria(CsApplication.
List list = criteria.add( Restrictions.eq("applicationCode", "mars")).list();


I've created POJOs & .hbm files for APPLICATION & TOKEN tables. TOKEN_USER table acts a place holder of many to many relation between the tokens and the user name.
My question is as I dont have a separate table/Java Object for USER entity,
is it possible to weave the association between TOKEN & TOKEN_USER tables? And how to add the condition in criteria object for (B.USER_NAME = 'jack') ?

Your help will be highly appreciated.

Thanks,
Velmurugan22k.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2008 5:19 pm 
Newbie

Joined: Tue Oct 07, 2008 12:17 pm
Posts: 13
I want to add some more information to the topic.
UserName field will be populated by an application which fetches the user information from the Novell network directory. As a single sign-on policy, we should not persist the user information in other places except Novell directory.

Thanks
Velmurugan


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

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.