-->
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: Hibernate and composite criteria
PostPosted: Wed Feb 09, 2011 5:26 pm 
Newbie

Joined: Wed Feb 09, 2011 4:58 pm
Posts: 1
Hello,
I need create composite select from hibernate criteria.

Eg.
I have slave object

Slave {
name;
surname;
born;
}

and object master

Master {
locality
position
List<Slave> slaves
}

I need composite select : Select * from Master where slaves in (Slave.name = 'Tomas'), but in Hibernate criteria

List mems = ses.createCriteria(Slave.class).add(Restrictions.eq("name", "Tomas")).list()
ses.createCriteria(Master.class).add(Restrictions.in("slaves", mems.toArray())).list()

But I get exception , because select is failed :
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: No value specified for parameter 1

Can you help me make right composite select please?

Regards Tomas


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.