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
Post a Comment