I'm having a problem with an order by in the query below when bed is not
defined. Classes below are simplified.
OQLQuery oql = _db.getOQLQuery( "SELECT p FROM Encounter p where p.unit
= $1 order by p.bed.sortOrder");
Class Encounter
{
long _id;
long _bedId;
long _patientID;
String _unit;
Patient _patient;
Bed _bed;
}
Class Bed
{
long _id;
int _sortOrder;
}
Class Patient
{
long _id;
int _sortOrder;
}
This query does work when _bed is defined. However when its null the that
record is not retrieved. Does Castor have the equivalent of an outer join
so that all encounters belonging/occurring in a given unit are retrieved.
Kevin
This is the query I want generated, The one actually generated.
SELECT "ED_ENCOUNTERS"."ID","ED_ENCOUNTERS"."VERSION",
"ED_ENCOUNTERS"."ED_PATIENT_ID","ED_ENCOUNTERS"."BED_ID",
"ED_ENCOUNTERS"."CASE_NUMBER","ED_ENCOUNTERS"."MRN","ED_ENCOUNTERS"."BED_NO",
"ED_ENCOUNTERS"."CHIEF_COMPLAINT","ED_ENCOUNTERS"."DATE_ADMITTED",
"ED_ENCOUNTERS"."DATE_DISCHARGED","ED_ENCOUNTERS"."DATE_TRIAGE_COMPLETED",
"ED_ENCOUNTERS"."DATE_SEEN_BY_ATTENDING","ED_ENCOUNTERS"."DATE_SEEN_BY_RESIDENT",
"ED_ENCOUNTERS"."DATE_VITALS_DUE","ED_ENCOUNTERS"."CARD_ORDER_STATUS",
"ED_ENCOUNTERS"."LAB_ORDER_STATUS","ED_ENCOUNTERS"."RAD_ORDER_STATUS",
"ED_ENCOUNTERS"."NO_INFORMATION_STATUS","ED_ENCOUNTERS"."ATTENDING_NAME",
"ED_ENCOUNTERS"."ATTENDING_RACFID","ED_ENCOUNTERS"."NURSE_NAME","ED_ENCOUNTERS"."NURSE_RACFID",
"ED_ENCOUNTERS"."RESIDENT_NAME","ED_ENCOUNTERS"."RESIDENT_RACFID",
"ED_ENCOUNTERS"."LAST_UPDATED","ED_ENCOUNTERS"."LAST_UPDATED_BY_RACFID","ED_ENCOUNTERS"."ACUITY",
"ED_ENCOUNTERS"."UNIT" FROM "ED_BEDS" "ED_BEDS_0","ED_ENCOUNTERS" WHERE
"ED_ENCOUNTERS"."BED_ID"="ED_BEDS_0"."ID" AND ("ED_ENCOUNTERS"
."UNIT" = '9S') ORDER BY "ED_BEDS_0"."SORT_ORDER"
This is the query I want generated
SELECT "ED_ENCOUNTERS"."ID","ED_ENCOUNTERS"."VERSION",
"ED_ENCOUNTERS"."ED_PATIENT_ID","ED_ENCOUNTERS"."BED_ID",
"ED_ENCOUNTERS"."CASE_NUMBER","ED_ENCOUNTERS"."MRN","ED_ENCOUNTERS"."BED_NO",
"ED_ENCOUNTERS"."CHIEF_COMPLAINT","ED_ENCOUNTERS"."DATE_ADMITTED",
"ED_ENCOUNTERS"."DATE_DISCHARGED","ED_ENCOUNTERS"."DATE_TRIAGE_COMPLETED",
"ED_ENCOUNTERS"."DATE_SEEN_BY_ATTENDING","ED_ENCOUNTERS"."DATE_SEEN_BY_RESIDENT",
"ED_ENCOUNTERS"."DATE_VITALS_DUE","ED_ENCOUNTERS"."CARD_ORDER_STATUS",
"ED_ENCOUNTERS"."LAB_ORDER_STATUS","ED_ENCOUNTERS"."RAD_ORDER_STATUS",
"ED_ENCOUNTERS"."NO_INFORMATION_STATUS","ED_ENCOUNTERS"."ATTENDING_NAME",
"ED_ENCOUNTERS"."ATTENDING_RACFID","ED_ENCOUNTERS"."NURSE_NAME","ED_ENCOUNTERS"."NURSE_RACFID",
"ED_ENCOUNTERS"."RESIDENT_NAME","ED_ENCOUNTERS"."RESIDENT_RACFID",
"ED_ENCOUNTERS"."LAST_UPDATED","ED_ENCOUNTERS"."LAST_UPDATED_BY_RACFID","ED_ENCOUNTERS"."ACUITY",
"ED_ENCOUNTERS"."UNIT" FROM "ED_BEDS" "ED_BEDS_0","ED_ENCOUNTERS" WHERE
"ED_ENCOUNTERS"."BED_ID"="ED_BEDS_0"."ID"(+) AND ("ED_ENCOUNTERS"
."UNIT" = '9S') ORDER BY "ED_BEDS_0"."SORT_ORDER"
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev