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.  [ 2 posts ] 
Author Message
 Post subject: Using Max whith CreateSQLQuery
PostPosted: Thu Oct 27, 2005 6:11 pm 
Newbie

Joined: Wed Oct 26, 2005 1:29 pm
Posts: 9
Location: brazil
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 2.1.7

Full stack trace of any exception that occurs: net.sf.hibernate.QueryException: No column name found for property [controle] [ select MAX {a.controle} from mediator.Arq003 {a}]

Name and version of the database you are using: SQL SEVER 2000

How can i use MAX and createSQLQuery i'm not having a spected result please some give me a light.

thanks JP


Top
 Profile  
 
 Post subject: sql
PostPosted: Fri Oct 28, 2005 12:02 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
http://www.hibernate.org/hib_docs/v3/re ... rysql.html
so

SQLQuery q = s.createSQLQuery( "select max( column_name ) as m_a_x from your_table_name ");
q.addScalar( "m_a_x", Hibernate.INTEGER );

List l = q.list();

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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