void bean_ptr<C>::hibernate(Archive & ar) { tmp_id=get_id(); if(tmp_id!=Database::NULL_ID && ar.getConnection()!=shared_res< real_bean<C> >::get_object()->get_key().con) throw std::logic_error("saving the bean from different database"); ar & hiberlite::sql_nvp< sqlid_t > ("id", tmp_id ); if(ar.is_loading()) *this=Registry<C>::get( bean_key(ar.getConnection(), tmp_id) ); }
inline bean_ptr<C> Database::loadBean(sqlid_t id) { return Registry<C>::get( bean_key(con,id) ); }