I have searched for this and I cannot find the answer. I think I'm missing something obvious or I don't understand Hibernate as well as I thought. I have a project which could access over 100 tables and so I am trying to implement a generic DAO which can read any of these tables and output the result in an excel sheet. Below is a snippit of the code I am using.
SQLQuery query = session.createSQLQuery("SELECT * FROM " + tables + " WHERE " + conditions );
List<Object[]> ob = query.list();
for(Object[] obj : ob ){
for(int x=0; x<obj.length; x++)
System.out.println("Col: " + obj[x].toString());}
However, when I print out the objects it gives all I am getting is the first character in the table.
Col1 Col2 Col3
1 8 8
When the actual values are:
Col1 Col2 Col3
135 800 867
Have I done something wrong or do I totally misunderstanding how Hibernate works.
Thanks in advanced.
JF
Edit The code I used to output the object has been added as well as results and actual table data.