I've been trying to devise a way to maintain uniqueness among different
entities by storing some kind of UUID based on the fields I want unique for
that entity Using JDO, and a GenericDAO (groovy)
Here is the method for put() in my GenericDAO:

def put(Object object) {
Collection objects = list();
 Boolean exists = false;

objects.each {if(it.getUniqueKey() == object.getUniqueKey()) {exists =
true}}

if(!exists) {
PersistenceManager pm = getPersistenceManager();

Transaction tx = pm.currentTransaction();
try {
tx.begin();
 pm.makePersistent(object);
tx.commit();
} finally {
 if (tx.isActive()) {
tx.rollback();
}
 pm.close();
}
}
 }
Where the uniqueKey field is a *unique string based on fields I need to be
unique*.
My question is what is good way to create this unique key string using for
example multiple string fields that will be consistent? My first inclination
was to use an MD5 but I see that datanucleus provides value generators that
might work better? Ideas? Or am I just going about this the wrong way?

-- 
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