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.  [ 4 posts ] 
Author Message
 Post subject: Criteria Query Api Problem!!!!!
PostPosted: Wed Aug 09, 2006 4:01 am 
Newbie

Joined: Tue Aug 01, 2006 4:28 am
Posts: 3



hi to every one!

i'm using HQL right now for my queries but I have tried to use Criteria Query Api. I just like to learn a bit from it...

But here is the problem. I have a "hibernate.cfg.xml" file that has these proporties:

hibernate.connection.driver_class
hibernate.connection.url
hibernate.connection.username
hibernate.connection.password
hibernate.connection.pool_size
show_sql
dialect

after these proporties, I have a mapping resource as:

<mapping resource="deneme/cities.hbm.xml" />

I would like to ask you that: when we are creating a criteria query as:

List list = sess.createCriteria(Order.class)
.add(Restrictions.between(lower,upper)
.list();

we are writing class name "Order.class". But in my hibernate.cfg.xml I made my mappings to mapping resource and I really don't know what to write between these:

List list = sess.createCriteria(?????)

thx for helps




Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 4:22 am 
Newbie

Joined: Wed Jul 26, 2006 10:35 am
Posts: 11
Euhmm, List list = sess.createCriteria(Order.class).list() ?

Or maybe I don't understand your question...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 4:50 am 
Newbie

Joined: Tue Aug 01, 2006 4:28 am
Posts: 3



Let me explain:

List cities = session.createCriteria(CQA.class).setProjection(
Projections.projectionList()
.add(Projections.property(ro.getobjid()))
.add(Projections.property(ro.getcity_desc()))
.add((Projection) Restrictions.like(ro.getcity_desc(),o1))

)
.list();


Here is the code that I have written for Criteria Query. But I donT know how to use or which class name to write inside of createCriteria....






Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 5:45 am 
Newbie

Joined: Wed Jul 26, 2006 10:35 am
Posts: 11
The class that you pass as an argument to createCriteria() needs to be the class of which you want the list() to return object instances of.


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