@@ -100,38 +100,16 @@ Kotlin specific Criteria API
100100
101101 Prefer the Kotlin specific Criteria API to DAO interfaces.
102102
103- Doma provides Kotlin specific Criteria API, ``KEntityql`` and ``KNativeSql`` DSLs.
104- They are very similar with the ``Entityql`` and ``NativeSql`` DSLs, which are described in :doc:`criteria-api`.
105- The biggest feature of the ``KEntityql`` and ``KNativeSql`` DSLs is simplicity.
106-
107- For example, when you use ``KEntityql``, you have to accept a lambda parameter in a WHERE expression as follows:
108-
109- .. code-block:: kotlin
110-
111- val entityql = Entityql (config )
112- val e = Employee_ ()
113-
114- val list = entityql
115- .from (e )
116- .where { c - >
117- c. eq(e. departmentId, 2 )
118- c. isNotNull(e. managerId)
119- c. or {
120- c. gt(e. salary, Salary(" 1000" ))
121- c. lt(e. salary, Salary(" 2000" ))
122- }
123- }
124- .fetch ()
125-
126- The lambda parameter ``c`` is a bit annoying.
127- On the other hand, when you use ``KEntityql``, the parameter is gone.
103+ Doma provides ``KQueryDsl``, a Criteria API specifically for Kotlin.
104+ It is very similar with the ``QueryDsl``, which is described in :doc:`query-dsl`.
105+ The biggest feature of the ``KQueryDsl`` is simplicity.
128106
129107.. code-block:: kotlin
130108
131- val entityql = KEntityql (config )
109+ val queryDsl = KQueryDsl (config )
132110 val e = Employee_ ()
133111
134- val list = entityql
112+ val list = queryDsl
135113 .from (e )
136114 .where {
137115 eq(e. departmentId, 2 )
@@ -143,9 +121,9 @@ On the other hand, when you use ``KEntityql``, the parameter is gone.
143121 }
144122 .fetch ()
145123
146- You can see a lot of sample code `here <https://github.com/domaframework/doma-it/tree/master/ kotlin/src/test/kotlin/org/seasar/doma/it/criteria > `_.
124+ You can see mode sample code `here <https://github.com/domaframework/kotlin-sample > `_.
147125
148- The ``KEntityql `` and ``KNativeSql`` DSLs are included in doma-kotlin.jar .
126+ The ``KQueryDsl `` is included in the doma-kotlin module .
149127Note that you should depend on doma-kotlin instead of doma-core in your build script.
150128You can write build.gradle.kts as follows:
151129
0 commit comments