In your class, if you have a Collection of entities that you want to not have 
duplicates you can make it a Set, and be sure that you've provided a proper 
equals() and hashCode() for your entities; specifically, do not include the 
primary key because it starts out null when you instantiate the entity, and 
then is set after the entity is persisted.  I don't know if there is anything 
on the JDO or DataNucleus site that explains this but I do remember reading 
about it in either a Hibernate book or on the Hibernate site.


tal wrote:
How do I enforce a unique constraint in GAE?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to