[odb-users] querying with relationships
    Boris Kolpackov 
    boris at codesynthesis.com
       
    Thu Jan 30 22:53:11 EST 2014
    
    
  
Hi Simón Emmanuel,
Simón Emmanuel Gutiérrez Brida <simon.gutierrez.brida at gmail.com> writes:
> if I declare the user field of Pattern like this
> 
> #pragma db not_null
> std::tr1::weak_ptr<User> user;
> 
> Then I have an already persistent when I do
> 
> persist(user); 
> persist(pattern);
> 
> if I declare the user field of Pattern like this
> 
> #pragma db not_null
> std::tr1::shared_ptr<User> user;
> 
> I have no persist problems
Hm, I am not sure what's going on here. If anything, I would expect
it to behave the other way around. Try to figure out which one of
these persist() calls is throwing and then see if the object with
such id actually already exists in the database.
> but now when I make a query to retrieve all users and store them
> in a vector<User> the push_back hangs in a odb load method
That would most likely be due to the lack of session.
Boris
    
    
More information about the odb-users
mailing list