I'd like to validate that a particular field on my domain object is unique. For example, I don't want usernames to be used more than once. I can annotate the domain object for persistence and enforce uniqueness but how do I get the validator framework to determine this before the INSERT takes place. I have some code that automatically sends errors back in the right way to the application tier and would rather continue to use it for all errors. I created a validator that should do this, but I can't use @PersistenceContext on the EntityManager. And If I use the EntityManagerFactory I get
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
-jeff
|