Page 1 of 1

1-many relationships, vector or QxList?

PostPosted: Fri Jan 22, 2016 10:54 am
by SteveW
Hi,

In the QxBlog tutorial there is a vector<> of "blogs" in an "author" to hold the 1-to-many relationship. There is also a vector<> of "blogs" in a "category" to hold that 1->many relationship.

However there is a QList<> of "comments" in a "blog" to hold that 1->Many relationship. Is there an important reason for the different collections in use here?

Thanks.

Re: 1-many relationships, vector or QxList?

PostPosted: Fri Jan 22, 2016 1:09 pm
by qxorm
Hello,

Is there an important reason for the different collections in use here?

No, using several containers types in samples projects just allow me to validate that there is no regression when a new QxOrm version is released.

QxOrm library supports the most common used containers in C++/Qt.
You have to choose your container type depending on your application.
For a list of supported containers, please read the QxOrm manual here : http://www.qxorm.com/qxorm_en/manual.html#manual_390

QxOrm provides also its own container, qx::QxCollection, more details about this container here : http://www.qxorm.com/qxorm_en/manual.html#manual_3930
qx::QxCollection is especially designed to get items from a database.
But you can use another container if you prefer working with classic C++/Qt containers.

Re: 1-many relationships, vector or QxList?

PostPosted: Fri Jan 22, 2016 4:40 pm
by SteveW
I will be using QxEE to generate most the initial code for our project, so I'll see what collections that produces. Just learning the ropes at the mo. Thanks.

Re: 1-many relationships, vector or QxList?

PostPosted: Sat Jan 23, 2016 8:24 am
by qxorm
By default, QxEntityEditor generates C++ files with qx::QxCollection container.
But you can easily customize QxEntityEditor to select another container (if you prefer working with another one).