10 Replies Latest reply on Mar 14, 2006 7:47 AM by tylerdurden001

    Using createCriteria in booking example

    nusa

      Hi,

      I'm unable to use createCriteria in LoginAction booking example.
      I change the following code from :

      List<User> results = em.createQuery("from User where username=:username and password=:password")
       .setParameter("username", user.getUsername())
       .setParameter("password", user.getPassword())
       .getResultList();
      

      into
       List<User> results = ( (HibernateEntityManager) em ).getSession().createCriteria(User.class)
       .add( Property.forName("this.username").ge( user.getUsername() ) )
       .add( Property.forName("this.password").ge( user.getPassword() ) )
       .list();
      

      but I got the following error :
      10:35:08,302 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/seam-booking].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      javax.faces.FacesException: Error calling action method of component with id _tagId0:_tagId6
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
       at javax.faces.component.UICommand.broadcast(UICommand.java:106)
      ...
      Caused by: javax.faces.el.EvaluationException: /home.xhtml @28,108 action="#{login.login}": javax.ejb.EJBException: null; CausedByException is:
       org.jboss.ejb3.entity.InjectedEntityManager
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
       ... 25 more
      Caused by: javax.ejb.EJBException: null; CausedByException is:
       org.jboss.ejb3.entity.InjectedEntityManager
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:46)
      ...
      


      Thanks for any help/suggestions/pointers.