I am new to Java language. I have a case there I want to create a list dynamically.
e.g.
public List getData(String classname)
{
List<classname> ob = querywithParams.list();
return ob;
}
I will call this function like
List<Student> ob=getData("Student");
How can achieve this thing in Java? I need this for creating a common DB Adapter for HQL execution.
try this
I don’t see you using the
string classnamein your method so you might as well remove it (If you wanted that just to specify the class type).So if you remove the string param, an example invocation would of the form :