-->
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.  [ 5 posts ] 
Author Message
 Post subject: Multiple Criterias?
PostPosted: Mon Nov 27, 2006 7:48 am 
Newbie

Joined: Thu Nov 23, 2006 11:08 am
Posts: 14
done


Last edited by Mørketid on Fri Jan 18, 2008 5:58 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 1:16 pm 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
Use createSQLQuery() instead of createQuery()

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 1:20 pm 
Regular
Regular

Joined: Thu Sep 22, 2005 1:53 pm
Posts: 88
Location: Rio de Janeiro
Hi, please always post your mapping files or java files.

with hql assuming your represented all your tables as pojos
the hql would become something like this:
Code:

SELECT p.produktnavn, k.knavn FROM Produkt p
JOIN p.produktkategoris pk
JOIN pk.kategori k
JOIN p.produktfarges pf
JOIN pf.farge f
where k.id = '1164113247767'
and p.pris between 0 and 5000
and f.id = '1164113248104'



Good luck

_________________
Don´t forget to rate!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 5:06 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
jobosser: I think what he ment is how do you transfer this sql code to pure Hibernate code. I believe he has Pojos classes already.

I would have helped if I knew how to :-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 6:53 am 
Regular
Regular

Joined: Thu Sep 22, 2005 1:53 pm
Posts: 88
Location: Rio de Janeiro
I thought the question was a bit vague because he was also talking about criterias... but if he wants to execute the sql as it is just use createSQLQuery

take a look at : Native Sql queries

good luck

_________________
Don´t forget to rate!


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