1-many relationships, vector or QxList?

Open discussion on QxOrm library

1-many relationships, vector or QxList?

Postby SteveW » Fri Jan 22, 2016 10:54 am

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.
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: 1-many relationships, vector or QxList?

Postby qxorm » Fri Jan 22, 2016 1:09 pm

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.
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: 1-many relationships, vector or QxList?

Postby SteveW » Fri Jan 22, 2016 4:40 pm

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.
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: 1-many relationships, vector or QxList?

Postby qxorm » Sat Jan 23, 2016 8:24 am

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).
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am


Return to QxOrm - Open discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron