Hello,
Yes it should work !
To define a composite key, I would recommend to :
- read this post in the FAQ :
http://www.qxorm.com/qxorm_en/faq.html#faq_101 - try the project sample located in the
./test/qxBlogCompositeKey/ directory of QxOrm package
- try QxEntityEditor : this app can be helpful to know how to implement some features of QxOrm library : first, design your database schema with a tool dedicated to your SGBD (SQLite Manager for SQlite database for example), then open QxEntityEditor and run the import process ==> you will see how to implement your model.
Then, about the composite foreign key, you have the solution here :
http://stackoverflow.com/questions/2158 ... m-is-a-man- Code: Select all
namespace qx
{
template <> void register_class(QxClass<secondtable> & t)
{
t.id(&secondtable::m_id, “second_table _key|first_table_key”);
t.data(&secondtable::m_text, "second_table_text");
qx::IxSqlRelation * pRelation = t.relationManyToOne(&secondtable::m_firsttable, “first_table”);
pRelation->getDataMember()->setName("first_table_key");
}
}
As you can see, you can define your relation with another key (
first_table), which is not the same key as your primary key (
first_table_key). And then, just put the correct name of your relation using
pRelation->getDataMember()->setName() method.