@@ -103,7 +103,7 @@ For example, to query ``Employee`` and ``Department`` entities and associate the
103103 department. getEmployeeList(). add(employee);
104104 });
105105
106- List<Employee > list = stmt. getResultList ();
106+ List<Employee > list = stmt. fetch ();
107107
108108 The above query issues the following SQL statement:
109109
@@ -157,7 +157,7 @@ For example, to query two columns with GROUP BY and HAVING clauses, write as fol
157157 return new Tuple2<> (first, second);
158158 });
159159
160- List<Tuple2<Long , String > > list = stmt. getResultList ();
160+ List<Tuple2<Long , String > > list = stmt. fetch ();
161161
162162 The above query issues the following SQL statement:
163163
@@ -214,7 +214,7 @@ We also support the following logical operators:
214214 });
215215 });
216216
217- List<Employee > list = stmt. getResultList ();
217+ List<Employee > list = stmt. fetch ();
218218
219219 The above query issues the following SQL statement:
220220
@@ -238,7 +238,7 @@ You can write a subquery as follows:
238238 .where(c - > c. in(e. employeeId, c. from(e2). select(e2. managerId)))
239239 .orderBy(c - > c. asc(e. employeeId));
240240
241- List<Employee > list = stmt. getResultList ();
241+ List<Employee > list = stmt. fetch ();
242242
243243 The above query issues the following SQL statement:
244244
@@ -269,7 +269,7 @@ innerJoin (Entityql, NativeSql)
269269 Listable<Employee > stmt =
270270 entityql. from(e). innerJoin(d, on - > on. eq(e. departmentId, d. departmentId));
271271
272- List<Employee > list = stmt. getResultList ();
272+ List<Employee > list = stmt. fetch ();
273273
274274 The above query issues the following SQL statement:
275275
@@ -291,7 +291,7 @@ leftJoin (Entityql, NativeSql)
291291 Listable<Employee > stmt =
292292 entityql. from(e). leftJoin(d, on - > on. eq(e. departmentId, d. departmentId));
293293
294- List<Employee > list = stmt. getResultList ();
294+ List<Employee > list = stmt. fetch ();
295295
296296 The above query issues the following SQL statement:
297297
@@ -328,7 +328,7 @@ You have to use the ``associate`` operation with join expression.
328328 department. getEmployeeList(). add(employee);
329329 });
330330
331- List<Employee > list = stmt. getResultList ();
331+ List<Employee > list = stmt. fetch ();
332332
333333 The above query issues the following SQL statement:
334334
@@ -363,7 +363,7 @@ You can associate many entities:
363363 })
364364 .associate(e, a, (employee, address) - > employee. setAddress(address));
365365
366- List<Employee > list = stmt. getResultList ();
366+ List<Employee > list = stmt. fetch ();
367367
368368 Aggregate Functions (NativeSql)
369369===============================
@@ -389,7 +389,7 @@ For example, you can pass the ``sum`` function to the select method:
389389 Listable<Salary > stmt =
390390 nativeSql. from(e). < Salary > select(sum(e. salary)). map(row - > row. get(sum(e. salary)));
391391
392- List<Salary > list = stmt. getResultList ();
392+ List<Salary > list = stmt. fetch ();
393393
394394 Note that you have to specify a type argument to the select method.
395395
@@ -418,7 +418,7 @@ Group by expression (NativeSql)
418418 return new Tuple2<> (id, count);
419419 });
420420
421- List<Tuple2<Integer , Long > > list = stmt. getResultList ();
421+ List<Tuple2<Integer , Long > > list = stmt. fetch ();
422422
423423 The above query issues the following SQL statement:
424424
@@ -464,7 +464,7 @@ We also support the following logical operators:
464464 return new Tuple2<> (first, second);
465465 });
466466
467- List<Tuple2<Long , String > > list = stmt. getResultList ();
467+ List<Tuple2<Long , String > > list = stmt. fetch ();
468468
469469 The above query issues the following SQL statement:
470470
@@ -497,7 +497,7 @@ We support the following order operations:
497497 c. desc(e. salary);
498498 });
499499
500- List<Employee > list = stmt. getResultList ();
500+ List<Employee > list = stmt. fetch ();
501501
502502 The above query issues the following SQL statement:
503503
@@ -518,7 +518,7 @@ Limit and Offset expression (Entityql, NativeSql)
518518 Listable<Employee > stmt =
519519 nativeSql. from(e). limit(5 ). offset(3 ). orderBy(c - > c. asc(e. employeeNo));
520520
521- List<Employee > list = stmt. getResultList ();
521+ List<Employee > list = stmt. fetch ();
522522
523523 The above query issues the following SQL statement:
524524
@@ -539,7 +539,7 @@ For Update expression (Entityql, NativeSql)
539539
540540 Listable<Employee > stmt = nativeSql. from(e). where(c - > c. eq(e. employeeId, 1 )). forUpdate();
541541
542- List<Employee > list = stmt. getResultList ();
542+ List<Employee > list = stmt. fetch ();
543543
544544 The above query issues the following SQL statement:
545545
@@ -578,7 +578,7 @@ We support the following expressions:
578578 return new Tuple2<> (id, name);
579579 });
580580
581- List<Tuple2<Integer , String > > list = stmt3. getResultList ();
581+ List<Tuple2<Integer , String > > list = stmt3. fetch ();
582582
583583 The above query issues the following SQL statement:
584584
@@ -599,7 +599,7 @@ Delete statement (Entityql)
599599 Employee_ e = new Employee_ ();
600600
601601 Listable<Employee > select = entityql. from(e). where(c - > c. eq(e. employeeId, 5 ));
602- Employee employee = select. getSingleResult (). orElseThrow(AssertionError :: new );
602+ Employee employee = select. fetchOptional (). orElseThrow(AssertionError :: new );
603603
604604 Statement<Employee > delete = entityql. delete(e, employee);
605605 Employee result = delete. execute();
@@ -618,7 +618,7 @@ Batch Delete is also supported:
618618
619619 Listable<Employee > select =
620620 entityql. from(e). where(c - > c. in(e. employeeId, Arrays . asList(5 , 6 )));
621- List<Employee > employees = select. getResultList ();
621+ List<Employee > employees = select. fetch ();
622622
623623 Statement<List<Employee > > delete = entityql. delete(e, employees);
624624 List<Employee > results = delete. execute();
@@ -751,7 +751,7 @@ Batch Update is also supported:
751751
752752 Listable<Employee > select =
753753 entityql. from(e). where(c - > c. in(e. employeeId, Arrays . asList(5 , 6 )));
754- List<Employee > employees = select. getResultList ();
754+ List<Employee > employees = select. fetch ();
755755 employees. forEach(it - > it. setEmployeeName(" aaa" ));
756756
757757 Statement<List<Employee > > update = entityql. update(e, employees);
@@ -802,7 +802,7 @@ To get a ``config`` object, call ``Config.get(this)`` in the default method as f
802802
803803 Employee_ e = new Employee_ ();
804804 Listable<Employee > stmt = entityql. from(e). where(c - > c. eq(e. employeeId, id));
805- return stmt. getSingleResult ();
805+ return stmt. fetchOptional ();
806806 }
807807 }
808808
@@ -821,7 +821,7 @@ Be careful of the following points when you use the ``select`` method:
821821 Listable<String > stmt =
822822 nativeSql. from(e). < String > select(e. employeeName). map(row - > row. get(e. employeeName));
823823
824- List<Salary > list = stmt. getResultList ();
824+ List<Salary > list = stmt. fetch ();
825825
826826Debugging (Entityql , NativeSql )
827827------------------------------ -
@@ -862,7 +862,7 @@ You can also get the ``Sql`` object by calling the ``peek`` method.
862862 .peek(System.out::println)
863863 .orderBy(c -> c.asc(d.location))
864864 .peek(sql -> System.out.println(sql.getFormattedSql()))
865- .getResultList ();
865+ .fetch ();
866866
867867The above code prints as follows:
868868
0 commit comments