Works, unless you want to allow users to edit their entries. If a user
changes the address after submitting then the new key is now different and
you'll end up saving a second entity. I wouldn't use any user editable data
in the key. Instead, I'd add a separate column to include your hash.



On Tue, Sep 6, 2011 at 11:32 PM, Robert Kluin <[email protected]>wrote:

> Hi Thomas,
>  If you want to avoid duplicates, the hash solution is great.
> Generate the hash, then In a transaction try to fetch the entity by
> id.  If you can't get it, insert it.
>
>
> Robert
>
>
>
>
>
>
> On Tue, Sep 6, 2011 at 21:16, Thomas Wiradikusuma
> <[email protected]> wrote:
> > Hi guys,
> >
> > I'm working on something like AirBnB but much simpler. I want to hint
> > user whenever he/she tries to submit duplicate entry.
> >
> > Currently, my model looks like:
> >
> > House {
> > Id
> > Username
> > Address
> > State
> > Country
> > }
> >
> > The id is made of address+state+country MD5. Is this the "correct" way
> > to do it? Or, should I go with auto-generated Id and add extra field
> > named 'hash', or how?
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Google App Engine" 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?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" 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?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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?hl=en.

Reply via email to