-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Validate uniqueness
PostPosted: Thu Jan 26, 2006 6:45 pm 
Newbie

Joined: Mon Dec 12, 2005 6:00 pm
Posts: 11
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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 27, 2006 6:42 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
there is not reasong why ehcache would be missing. Double check your classpath

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 27, 2006 11:32 am 
Newbie

Joined: Mon Dec 12, 2005 6:00 pm
Posts: 11
I'm using the ejb3 profile from the jboss 4.0.3 installer. I'll try sp1 and see if it fixes the problem. Is there a known issue with this version of jboss?

-j


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 27, 2006 1:43 pm 
Newbie

Joined: Mon Dec 12, 2005 6:00 pm
Posts: 11
Same problem with the ejb3 profile using the jboss installer for 4.0.3sp1. The code I'm using is pretty simple:

EntityManagerFactory emf = Persistence.createEntityManagerFactory("em1");
entityManager = emf.createEntityManager();

Its the first line of code there that barfs.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 29, 2006 5:34 pm 
Newbie

Joined: Mon Dec 12, 2005 6:00 pm
Posts: 11
I added ehcache to my server lib and all was fine. Sorry for wasting everyone's time.

-j


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.