1 Reply Latest reply on Jan 8, 2009 6:14 PM by Shervin Asgari

    Transaction closed when checking user using EntityQuery

    Anthony Yulo Newbie

      Is it a good idea to use a class/seam component that extends an EntityQuery when checking for user and password credentials?

      Inside the authenticator component I have created a Seam Component that extends EntityQuery which checks if the user and password is valid on a USER table:

      User theuser= (User)userQuery.getSingleResult();
      } catch {PersistenceException pe) {
        facesMessage.add("Invalid Username/Password");

      Problem with this code is the scenario when the first login attempt is invalid, I can't retry my login anymore as the 2nd attempt will now issue an Exception saying that there is no Tranasction open

      Or shhould i just use a Session Bean instead of the EntityQuery?