Reputation: 8113
At this point I am very confused. I have a controller that uses my DAO to run a query, but it is giving me a null pointer exception. I have been solving error after error but can't seem to get to the root of them all.
Controller:
DAO d = new DAO();
List<objects> foo = d.callQuery(new object());
DAO:
Calendar cal = new GregorianCalendar();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
Date begin = new Date(cal.getTimeInMillis());
Date end = new Date(cal.getTimeInMillis());
String theQuery = "SELECT * from table1";
Query query = em.createNativeQuery(theQuery).setParameter("begin", begin).setParameter("end", end);
Error leads me to this line: Query query = em.createNativeQuery(theQuery).setParameter("begin", begin).setParameter("end", end);
What could possibly be null? Note: this is not my full query, my full query is working and contains both parameters.
I printed begin
and end
and they both gave me the expected results. The stack trace leads me from the second line of my controller to the create query line.
Upvotes: 1
Views: 2768
Reputation: 501
I feel like I need more information, but trying to give you some clue:
I hope these questions can help.
Upvotes: 1