-->
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: Native SQL, how to?
PostPosted: Fri Dec 10, 2004 6:59 am 
Newbie

Joined: Thu Dec 09, 2004 7:31 am
Posts: 2
[b]Hibernate version:2.1.6

Hi

just a stupid question - I have a table with columns
idclient
uid
...

I'm trying to call

List list = session.createSQLQuery("select {c}.idclient as
{c.idclient} FROM SupClient {c}", "c", SupClient.class).list();

- so I'm interresting about only one column from table
(the true story is much more complicated including
outer join of 4 tables).

The result is exception -
ERROR JDBCExceptionReporter: No such column name

Doesn't matter I'm selecting only one column, Hibernate
is trying to fetch also the next columns (uid, ...) and of course there're no aliases in my sql related to the ones.

Please, any idea?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 10, 2004 4:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
as per docs (and said many times now ;), currently you can only fetch FULL entity objects with nativesql.

if you want projection sql use raw jdbc.

_________________
Max
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.  [ 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.