-->
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: How to select a cat's name using a SQL query ?
PostPosted: Tue Nov 02, 2004 4:55 pm 
Newbie

Joined: Thu Oct 28, 2004 1:33 pm
Posts: 14
Location: Stuttgart
Can please somebody give me hand and tell me how just to get the name of cat using Standard SQL queries in Hibernate ? My attempts always just return a SQLException

// this works
String sql = "select {cat.*} from cat {cat}";
Query sqlQuery = s.createSQLQuery(sql, "cat", Cat.class);

// this doesn't
String sql = "select cat.name as {cat.name} from cat {cat}";
Query sqlQuery = s.createSQLQuery(sql, "cat", Cat.class);


// the manual states: (?)
//Note: if you list each property explicitly, you must include all properties of the class and its subclasses!

Thanks, Dirk


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 02, 2004 6:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
SQL querys can only return mapped entities so far. Use direct JDBC


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.