Würde gerne den Benutzern meiner Webanwendung ermöglichen meine Datenbank zu durchsuchen. Dazu habe ich (zum Testen) folgendes gemacht:
Jedoch bekomme ich folgende Exception.
Führe ich die query direkt auf meiner db aus liefert sie ergebnisse. Was mache ich jetzt schon wieder falsch? ;(
Java:
@ManagedBean(name = "recipeController")
@SessionScoped
public class RecipeController implements Serializable {
...
public String find(){
List results = getFacade().getEntityManager().createQuery("select * from recipe").getResultList();
System.out.println(results.size());
return null;
}
Jedoch bekomme ich folgende Exception.
Java:
WARNING: #{recipeController.find}: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [select * from recipe;], line 1, column 7: unexpected token [*].
Internal Exception: NoViableAltException(93@[330:16: ( DISTINCT )?])
javax.faces.FacesException: #{recipeController.find}: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [select * from recipe;], line 1, column 7: unexpected token [*].
Internal Exception: NoViableAltException(93@[330:16: ( DISTINCT )?])
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
Führe ich die query direkt auf meiner db aus liefert sie ergebnisse. Was mache ich jetzt schon wieder falsch? ;(