I am unable to create a list of objects dynamically. I run a SQL query on the database and populate objects of types that I also know aprior. I read the query as a string, run it on the database and want to be able to populate these objects of classes whose names are known to me also based on the type of the query. In this query, SomeClass is a variable.
Class myClass = Class.forName(" SomeClass");
Object myClassObj = myClass.newInst ance(null);
When I say,
List<myClassObj > myClassObjList = null;
myClassObjList = somDao.getmyLis t(qry);
I get an error, "myClassObj cannot be resolved to a type". This is very important as in my case I have a dynamically created query that is run on the database to create objects of specific type in advance and I am sending these list of objects to a jsp page for display and other purposes.
Thanks in advance.
Regards
Kris
Class myClass = Class.forName(" SomeClass");
Object myClassObj = myClass.newInst ance(null);
When I say,
List<myClassObj > myClassObjList = null;
myClassObjList = somDao.getmyLis t(qry);
I get an error, "myClassObj cannot be resolved to a type". This is very important as in my case I have a dynamically created query that is run on the database to create objects of specific type in advance and I am sending these list of objects to a jsp page for display and other purposes.
Thanks in advance.
Regards
Kris
Comment