[odb-users] Create New Object
macromarship at gmail.com
Mon Jun 24 06:42:36 EDT 2013
I suggest you auto load that in your construct.
On Mon, Jun 24, 2013 at 6:39 PM, Tarik BENZ <tenchu.tarik at hotmail.fr> wrote:
> Hello Scott,
> Thank you for the answer,
> Actually what I want is :
> I have an "ID" for an entry to MyOtherClass table
> I want to create a new "MyClass" and affect the "ID" the the foo object.
> Kind Regards,
> Date: Mon, 24 Jun 2013 18:27:50 +0800
> Subject: Re: [odb-users] Create New Object
> From: macromarship at gmail.com
> To: tenchu.tarik at hotmail.fr
> CC: odb-users at codesynthesis.com
> Hi. Tarik.
> If you create MyClass directly. the foo within it will be null, or
> On Mon, Jun 24, 2013 at 4:26 PM, Tarik BENZ <tenchu.tarik at hotmail.fr>wrote:
> I have an a class like this :
> class MyClass
> std::shared_ptr<MyOtherClass> foo;
> My question is :
> "MyOtherClass" refers to a database table.
> To create a new "MyClass" object, do I need to retrieve the data
> into "MyOtherClass" from the database then affect this object to "foo"
> or I can just use the "ID" of the "MyOtherClass"?
> Because for the moment I load all the "MyOtherClass" data from the
> then I try to find the correct entry with it's "ID". I am not sure It is
> the correct way
> because it is really too heavy to do this!
> Thank you in advance for your help.
More information about the odb-users