Using a Set cannot help - they still need to be read into memory and
adding to a set will still replace an existing equal entry.
So at the lowest level, you still need to do a read before your write
if you want to avoid clobbering existing data with the same key.
On 19 Jan 2010, at 03:08, Rusty Wright wrote:
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
.
--
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.