• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving meta data / column name from a native sql query / store procedure  RSS feed

Kev Miller
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'd like to use Hibernate to abstract from different databases that I am using. I have to run plain sql statements against different (vendor) databases WITHOUT mapping the result to objects that I would first have to create. I am only interested in the generic jdbc/database abstraction feature since my system requires updates to the list of registered sql queries quite frequently.

I have used hibernate (native queries) for this which works fine.
However I need to determine the type of the row elements coming back and had to find out that the hibernate method that would do this (getReturnTypes() in SQLQuery) has not been implemented yet and only throws

Exception in thread "main" java.lang.UnsupportedOperationException: not yet implemented for SQL queries
at org.hibernate.impl.SQLQueryImpl.getReturnTypes(SQL QueryImpl.java:226)

Is there any workaround to this problem? I had to look into hibernate because I have oracle specific code in one of my classes that is using jdbc. The number of different sql statements that this class is running is very high and I can't create Java Beans for them since a new sql statement might be added at runtime.

Also I need a way to query for the column names of the result set coming back.

Is there any way in hibernate or a different jdbc abstraction framework (vendor neutral) that would allow me to query for data types and column names in a result set?

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!