hibernate - How to pass Table Name as parameter to HQL Query -


hi want pass table name parameter hql query have used string concatenation as:

string hql = "from " + table ; query query = session.createquery(hql); return query.list(); 

this implementation works throws sql injection exception. there way can pass table name avoiding exception

using hibernate query language (hql) can perform database operation without using query. means don't need use table name perform operation. can using pojo or beans class name.

hql=" pojo class";
query query = session.createquery(hql); return query.list();


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -