I've written some a small class hierarchy mapped to QxOrm. As a difference of qxDllSample, the relation of 1 to N is set to the base class. QxOrm is able to create the tables of the database successfully but, when querying information about the derived class, the column of the external key refers to the table of the base class than the table of the derived class.
Bellow, there is an example:
Hierarchy of classes:
Class Appointment: has a relation of 1 to N with AbsInfo class.
Class AbsInfo: has a relation of N to 1 with Appointment class. Appoint_id is the foreign key to Appointment.
Class InfoHL7: derives from AbsInfo. (no more additional info is included respected to base class)
The tables corresponding to the previous classes are created successfully. See the SQL sentences bellow:
- Code: Select all
[QxOrm] sql query (112 ms) : CREATE TABLE Appointment (appoint_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, description TEXT)
[QxOrm] sql query (100 ms) : CREATE TABLE AbsInfo (info_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, description TEXT, appoint_id INTEGER)
[QxOrm] sql query (98 ms) : CREATE TABLE InfoHL7 (info_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, description TEXT, appoint_id INTEGER)
At the program, when I query for HL7 objects, the next SQL query is executed. as you can see, appoint_id column is referring to AbsInfo table, but not to InfoHL7.
- Code: Select all
SELECT InfoHL7.info_id AS InfoHL7_info_id_0, InfoHL7.description AS InfoHL7_description_0, AbsInfo.appoint_id AS AbsInfo_appoint_id_0 FROM InfoHL7
The same happens when relations are also included when querying for infoHL7 objects. The SQL sentence is bellow:
- Code: Select all
SELECT InfoHL7.info_id AS InfoHL7_info_id_0, InfoHL7.description AS InfoHL7_description_0, AbsInfo.appoint_id AS AbsInfo_appoint_id_0, Appointment_1.appoint_id AS Appointment_1_appoint_id_0, Appointment_1.description AS Appointment_1_description_0 FROM InfoHL7 LEFT OUTER JOIN Appointment Appointment_1 ON Appointment_1.appoint_id = AbsInfo.appoint_id
Could you confirm that this is a bug of the library?
Thanks and Best Regards,
Joaquim Duran