This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm trying to write a custom validator as described here
The validator is intended for use with new users registering and he has to check whether the login given by user is still available. Therefore I need to connect with the data layer to execute a finder on users. Is there any simple way of doing that?
Going by the validator example that you pointed out, the Validator appears to be just some simple Java class. Instead of injecting the EntityManager, you can look up the EntityManager through JNDI lookup code, in your validator class. By default in JBoss, the EntityManager is not available in the JNDI. Go through this chapter ("Persistence unit JNDI Bindings" section) which explains how to make the EntityManager available in the JNDI tree, in JBoss.