[odb-users] Create New Object

Tarik BENZ tenchu.tarik at hotmail.fr
Mon Jun 24 04:26:38 EDT 2013


Hello,

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 database,
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.
Tarik
 		 	   		  


More information about the odb-users mailing list