-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Critera. javax.persistence alternative?
PostPosted: Thu Nov 27, 2008 1:23 am 
Newbie

Joined: Tue Nov 04, 2008 7:56 pm
Posts: 3
Hi,

This is my situation ...

Let's say I have two database tables:

Employee(id, name)
Position(emp_id, name)

I want to retrieve all employees where their position is in {'manager', 'clerk', 'cleaner'}.

I know how to do this in normal HSQL, I have an idea how to do this using the org.hibernate library like:

http://www.hibernate.org/hib_docs/v3/ap ... teria.html

is there a way I can do this using just the javax.persistence API?
My requirements specify me to do this.

So in the end I want to somehow be able to do:

List<String> positions = new ArrayList<String>();
positions.add("manager");
positions.add("clerk");

SELECT e FROM Employee e, Position p
WHERE p.name in {positions}

well not EXACTLY that but I hope you get the idea.

Thanks thanks thanks for any help at all!
pea


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 27, 2008 1:25 pm 
Newbie

Joined: Thu Aug 11, 2005 12:15 am
Posts: 9
Take a look at http://www.jroller.com/RickHigh/entry/i_implemented_a_detached_criteria


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 27, 2008 1:31 pm 
Newbie

Joined: Thu Aug 11, 2005 12:15 am
Posts: 9
Take a look at http://www.jroller.com/RickHigh/entry/i_implemented_a_detached_criteria


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.