I am trying to get all the table names in a database(Oracle 11g) to dynamically generate checkboxes for each table in the UI. I have not mapped any of these tables in the .cfg.xml file.
I used the below code :
List<Object> list = sessionProd.createQuery("select table_name from user_tables").list();
for(Object l : list){
System.out.println("L : " +l.toString());
}
But it errored as below : org.hibernate.hql.internal.ast.QuerySyntaxException: user_tables is not mapped [select table_name from user_tables]
Please let me know if there is any way to get all table names in Hibernate 4
Using a native SQL query method resolved the problem. Thanks for your suggestions.
The following code worked for me:
List<Object> list = sessionProd.createSQLQuery("select table_name from user_tables").list();