Content deleted Content added
m reword to avoid second person |
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags |
||
Line 52:
The corresponding Oracle syntax SQL statement is assumed to be as follows:
<
SELECT t1.EMPLOYEE_ID,
t1.LASTNAME || ', ' || t1.FIRSTNAME AS NAME,
Line 61:
AND t1.RETIRED=0
ORDER BY t1.LASTNAME, t1.FIRSTNAME
</syntaxhighlight>
This SQL statement can be created using Empire-db's command API using object model references like this:
<
SampleDB db = getDatabase();
// Declare shortcuts (not necessary but convenient)
Line 84:
cmd.orderBy(EMP.LASTNAME);
cmd.orderBy(EMP.FIRSTNAME);
</syntaxhighlight>
In order to execute the query and retrieve a list of POJO's holding the query result the following code may be used:
<
// Class definition for target objects
public class EmployeeInfo {
Line 108:
reader.close()
}
</syntaxhighlight>
Empire-db also supports field access through object references or obtaining query results as XML.
|