-->
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.  [ 1 post ] 
Author Message
 Post subject: Native SQL Queries and how to get the column names??
PostPosted: Wed Jul 15, 2009 12:37 pm 
Newbie

Joined: Mon Oct 03, 2005 12:07 pm
Posts: 8
hi,

I would like to get the Column Names out of a native SQL Query.

The query looks like that for example:
String sqlCMD = "SELECT SQL_CALC_FOUND_ROWS c.diagramobject_id, c.objecttypename, c.name " +
"FROM diagramobject c " +
"LEFT OUTER JOIN diagramobject_property d ON (d.diagramobject_id = c.diagramobject_id) " +
"WHERE c.organisation_id="+organization_id+" " +
"AND lower(c.name) LIKE lower('"+search+"') " +
"AND c.deleted NOT LIKE 'true' ";
"AND lower(d.value) LIKE lower('"+search+"') ";

The Result:
List<Object[]> diagramObjectList = query.list();

The Problem is the resulting Object:
diagramObjectList => does only contain the value's like [1,blabla,anotherBla]
what I would like to have is: [diagramobject:1,objecttypename:blabla,name:anotherBla]

running the query with c.diagramobject_id as diagramobject_id => does not change anything.

What can be done in usual JDBC is to get the MetaData of the Result-Set to get the column names.
But there is no way of doing that through Hibernate?

What can be done to solve this? I don't know the field names of the SQL Query as they may vary.

thanks,
sebastian

_________________
http://www.laszlo-forum.de
http://www.webbase-design.de


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.