I have a simple query and got into trouble if I add an order by statement (where condition
is not used).
Without the order statement everything works fine. What can happen, that an order by
statement causes the EJBException:Nullpointerexception occurs?
I use JBoss VM 4.0 Eclipse Plug-In and Hypersonic Database.
Here is the code snippet..
@SuppressWarnings("unchecked")
public List getTaskEntryForAdministration(String Worker, String Projekt) {
try {
String querystr = "";
String Filter = "";
if (!Worker.equals(""))
Filter = Filter +" where worker.name='"+Worker+"'";
if (!Projekt.equals("")){
if (Filter.equals(""))
Filter = Filter +" where
task.project.project_name='"+Projekt+"'";
else
Filter = Filter +" and
task.project.project_name='"+Projekt+"'";
}
String OrderBy = new String(" order by
worker.name,task.project.project_name,task.task_name,start_time,end_time");
querystr = "from TaskEntry"+ Filter + OrderBy;
List TaskEntryList = null;
Query query = this.entityManager.createQuery(querystr);
if (query!=null){
TaskEntryList = query.getResultList();
}
return TaskEntryList;
} catch (EJBException e) {
e.printStackTrace();
if (e.getCause() == null) e.initCause(e.getCausedByException());
throw e;
}
}
cheers
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039380#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...