Skip to content

Commit b062f87

Browse files
committed
Improve a document [ci skip]
1 parent a4435ae commit b062f87

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/criteria-api.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,27 @@ The above query issues the following SQL statement:
654654
Tips
655655
====
656656

657+
Execution in Dao (Entityql, NativeSql)
658+
--------------------------------------
659+
660+
It is useful to execute DSLs in the default method of the Dao interface.
661+
To get a ``config`` object, call ``Config.get(this)`` in the default method as follows:
662+
663+
.. code-block:: java
664+
665+
@Dao
666+
public interface EmployeeDao {
667+
668+
default Optional<Employee> selectById(Integer id) {
669+
Employee_ e = new Employee_();
670+
List<Employee> list =
671+
Entityql.from(e)
672+
.where(c -> c.eq(e.employeeId, id))
673+
.execute(Config.get(this));
674+
return list.stream().findFirst();
675+
}
676+
}
677+
657678
The use of the select method (NativeSql)
658679
----------------------------------------
659680

0 commit comments

Comments
 (0)