• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate Critera. javax.persistence alternative?

 
mister pea
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/api/

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
 
mister pea
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops that link was supposed to be:

http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Criteria.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!