[odb-users] unable to map C++ type '::__gnu_cxx::new_allocator<
::std::weak_ptr< ... error in One-to-Many relationships
Monika Idzik
moni.idzik at gmail.com
Tue Sep 3 16:31:30 EDT 2019
Dear ODB-Users,
I encountered a problem trying to make a one-to-many relationship in odb, I
get the following error:
src/experiment_configuration/experiment_configuration.hpp:218:43: error:
unable to map C++ type '::__gnu_cxx::new_allocator< ::std::weak_ptr<
::performance_test::AnalysisResult > >::value_type' used in data member
'results' to a SQLite database type
src/experiment_configuration/experiment_configuration.hpp:218:43: info: use
'#pragma db value_type' to specify the database type
I have one class called ExeprimentConfiguration and one class
AnalysisResult. I want to have one (ExeprimentConfiguration) to many
(AnalysisResult) relationship between them. These 2 classes are in two
separate files:
src/experiment_configuration/experiment_configuration.hpp
and
src/experiment_execution/analysis_result.hpp
Here basic code from the files:
//experiment_configuration.hpp
#include <odb/core.hxx>
class AnalysisResult;
#pragma db object
class ExperimentConfiguration
{
public:
...
private:
...
friend class odb::access;
#pragma db id
boost::uuids::uuid m_id;
#pragma db value_not_null inverse(configuration)
std::vector<std::weak_ptr<AnalysisResult>> results;
};
//analysis_result.hpp
#include <odb/core.hxx>
#include "../experiment_configuration/experiment_configuration.hpp"
#pragma db object
class AnalysisResult
{
public:
...
private:
...
friend class odb::access;
...
#pragma db id
unsigned long id_;
#pragma db not_null
std::shared_ptr<ExperimentConfiguration> configuration;
};
I followed here section 6.2.2. One-to-Many Relationships in the odb manual.
I use ODB object-relational mapping (ORM) compiler for C++ 2.5.0-b.16 and
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Could you help me figuring out what I'm doing wrong?
Thank you,
Monika
More information about the odb-users
mailing list