I have created a new object, set the values (including the ID/PK) but when I use qx::dao::insert, it ignores the ID I have specified.
How can I specify the PK value of the row I want to persist?
I have created a new object, set the values (including the ID/PK) but when I use qx::dao::insert, it ignores the ID I have specified.
How can I specify the PK value of the row I want to persist?
I think you have defined your primary key as auto-increment (this is the default value for numeric types with QxOrm library). If you want to define the primary key yourself before inserting an instance to database, register your ID like this :
template <>
void register_class(QxClass<MyClass> & t)
{
qx::IxDataMember * pId = t.id(& MyClass::m_my_id, "my_id");
pId->setAutoIncrement(false);
// etc...
}