1

I am generating a report using Hibernate.

Constructing SQL from various table joins and querying using Hibernate scrollable results.

Below is the sample code:

Query query = session.createSQLQuery("select * from A, B where A.id= B.Val");
ScrollableResults results  = query.scroll(ScrollMode.FORWARD_ONLY);

I want to know all the column names and column types before generating an Excel report.

How to achieve this with Hibernate scrollable results?

TT.
  • 15,774
  • 6
  • 47
  • 88
Ashok Kumar
  • 145
  • 2
  • 12
  • http://stackoverflow.com/questions/27364531/bulk-reading-of-data-in-hibernate-using-scrollable-result-set – Jobin Dec 14 '16 at 11:40
  • Don't know about the column type but You can do something like `query.results()`. It will return a list of maps, a map per row. Each map would map column name to an object corresponding to the column value for the given row. – StackUseR Dec 14 '16 at 11:41
  • Please look into the following example: http://stackoverflow.com/questions/19418500/get-table-column-names-in-hibernate – KayV Dec 14 '16 at 12:07
  • Here the column list doesn't belong to any single entity. Columns are from multiple table/entity joins. Above examples are for all columns in a single table – Ashok Kumar Dec 14 '16 at 12:20

0 Answers0