Message from discussion
@reference and error : @Id field cannot be nul
Received: by 10.52.240.229 with SMTP id wd5mr14957604vdc.8.1343648004737;
Mon, 30 Jul 2012 04:33:24 -0700 (PDT)
X-BeenThere: morphia@googlegroups.com
Received: by 10.220.221.197 with SMTP id id5ls3452073vcb.5.gmail; Mon, 30 Jul
2012 04:33:24 -0700 (PDT)
Received: by 10.52.240.229 with SMTP id wd5mr14957583vdc.8.1343648004197;
Mon, 30 Jul 2012 04:33:24 -0700 (PDT)
Received: by 10.52.240.229 with SMTP id wd5mr14957581vdc.8.1343648004165;
Mon, 30 Jul 2012 04:33:24 -0700 (PDT)
Return-Path: <scotthernan...@gmail.com>
Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41])
by gmr-mx.google.com with ESMTPS id dy2si1350156vdb.1.2012.07.30.04.33.24
(version=TLSv1/SSLv3 cipher=OTHER);
Mon, 30 Jul 2012 04:33:24 -0700 (PDT)
Received-SPF: pass (google.com: domain of scotthernan...@gmail.com designates 209.85.212.41 as permitted sender) client-ip=209.85.212.41;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of scotthernan...@gmail.com designates 209.85.212.41 as permitted sender) smtp.mail=scotthernan...@gmail.com; dkim=pass header...@gmail.com
Received: by vbkv13 with SMTP id v13so5082935vbk.0
for <morphia@googlegroups.com>; Mon, 30 Jul 2012 04:33:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to
:content-type:content-transfer-encoding;
bh=Jvq/sw3lnkuaN4fufV8EyUbBLT7w4gZe8VkEy8JnwUo=;
b=zKQ5Tj4bHWWhEe9oTW6x+jwt3DeBziCz0FV1iFpOIK1kr4P2iG4IG317HUqUaUUJY5
R87P1gTGFSboy6V5rg3tUw2Ll15wwJJneN/sWnB017Vy6C84FkcA8HXSeOzdBJE72nQO
/Eze8aSvXlW2NDjtaDjrmHFUCO9G0R/rM5KWRAtg0C/4EBBFgGqklfGpWtoXIXSNNwvn
YI+PG4YbOBpalm1qgggsxrT2rVaXqf+6lPQ3yd5ktY8e0T+3TrHTpYQZcicBLL0xOP0D
9mrKhPq0xuZ22VR9hZji/N6X1jf77UlF+iDRupiWOWiFs7bK6i2xpqA3HwOfevsr/+Q4
w71w==
Received: by 10.52.99.227 with SMTP id et3mr9269982vdb.110.1343648004000; Mon,
30 Jul 2012 04:33:24 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.220.0.197 with HTTP; Mon, 30 Jul 2012 04:33:03 -0700 (PDT)
In-Reply-To: <0f479a2b-3d4e-4563-b0ad-be54cc8415c2@googlegroups.com>
References: <eb95201f-2c63-4e3a-87ba-88eeb3485042@googlegroups.com>
<CALOM=qhr1SypbMgEnhu7ECM5LdZqxGL6Qds+H=p99o1mqVf...@mail.gmail.com> <0f479a2b-3d4e-4563-b0ad-be54cc8415c2@googlegroups.com>
From: Scott Hernandez <scotthernan...@gmail.com>
Date: Mon, 30 Jul 2012 07:33:03 -0400
Message-ID: <CALOM=qh1ArQSa5Uid2qzwT4NcLX8+A_KWAH3VJ=aSpd+YoG...@mail.gmail.com>
Subject: Re: [morphia] @reference and error : @Id field cannot be nul
To: morphia@googlegroups.com
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
I'm not sure I understand. Here is a description of what an ObjectId
is: http://www.mongodb.org/display/DOCS/Object+IDs
They are like UUIDs and you can create many at the same time and they
will all be different.
On Mon, Jul 30, 2012 at 3:21 AM, lolveley <lolve...@laposte.net> wrote:
> hi scott
>
> I understood your answer but I have a question : if I create the objectId=
at
> the same time as the creation of the class, how the computer can set a
> objectId different than the objectId already stored in the base? I mean a=
re
> the objectId differents one from another? how is it made?
>
> Le dimanche 29 juillet 2012 20:45:58 UTC+2, Scott Hernandez a =C3=A9crit =
:
>>
>> Just change your entities to declare the id field with an initial value:
>>
>> @Id ObjectId id =3D new ObjectId();
>>
>> The id will be assigned during your save, but not by the server. So
>> either way the client will have to create the ObjectId.
>>
>>
>