Just wanted to say that I see that what I'm trying to do is just fundamentally wrong and will decidedly cause serious problems in the longer term. I suppose it is best to check for uniqueness in the service layer.
On Feb 24, 12:05 pm, atomi <at...@verizon.net> wrote: > 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.