" *****************************************************************************************************
*
*  orb3.txt
*
*   This examples shows how to use a broker to retrieves instances using an arbitrary query 
*
*
******************************************************************************************************"


| aModel aTextDisplay anOrb courses sqlStatement aQrb|
aTextDisplay := TextWindow  windowLabeled: 'LPC Brokers - using an orb - 3'
                           frame: (0 @ 0 corner: 500 @ 500).
aTextDisplay cr. 
 
aModel := LPCModel getName: #LpcSample.
courseType :=aModel typeNamed: #Course.

anOrb := LPCObjectRequestBroker new.
anOrb driverConnectWindow: aTextDisplay.

sqlStatement := 'Select * from course where description like ''%Intro%'''.
courses := anOrb lookUpUsingSql: sqlStatement withType: courseType.
courses do: [ :course | aTextDisplay nextPutAll: course asString ; cr ].
 
anOrb disconnect.
 
