-->
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: How to use COUNT in method createSqlQuery ??
PostPosted: Tue Aug 31, 2004 8:27 am 
Newbie

Joined: Thu Jun 10, 2004 5:37 am
Posts: 19
I'm using the method createSqlQuery which permits to execute SQL.
And I'd like to use the function COUNT in my sql query but I don't know how to to this.

Here is how I do :

createSqlQuery("SELECT count({p.id}) FROM MY_TABLE",
new String[] { "p" },
new Class[] { HbMyTable.class });


I also tried
createSqlQuery("SELECT count(x.ID as {p.id}) FROM MY_TABLE x",
new String[] { "p" },
new Class[] { HbMyTable.class });

Is it possible to use COUNT in createSqlQuery ?
Because I really need to do this in order to win time.


Thank you for your help ! :)

Nicolas


Top
 Profile  
 
 Post subject: count in SQL
PostPosted: Wed Sep 22, 2004 3:57 pm 
Newbie

Joined: Sun Sep 19, 2004 9:03 am
Posts: 6
Any idea ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 4:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You cant. Just use session.connection() and use plain old JDBC


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 4:17 pm 
Newbie

Joined: Sun Sep 19, 2004 9:03 am
Posts: 6
michael wrote:
You cant. Just use session.connection() and use plain old JDBC


Ok thx !


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.