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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -