IgGusev commented on code in PR #6207:
URL: https://github.com/apache/ignite-3/pull/6207#discussion_r2206754071


##########
docs/_docs/developers-guide/spring-data/spring-data.adoc:
##########
@@ -0,0 +1,173 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+= Apache Ignite With Spring Data
+
+== Overview
+
+Spring Data Framework provides a unified and widely used API that allows 
abstracting an underlying data storage from the
+application layer. Spring Data helps you avoid locking to a specific database 
vendor, making it easy to switch from one
+database to another with minimal efforts. Apache Ignite supports Spring Data 
JDBC by implementing `IgniteDialect`.
+
+== Maven Configuration
+
+The easiest way to start working with Apache Ignite's Spring Data repository 
is by adding the following Maven dependencies
+to the application's `pom.xml` file:
+
+[tabs]
+--
+tab:pom.xml[]
+[source,xml, subs="attributes,specialchars"]]
+----
+<dependency>
+    <groupId>org.apache.ignite</groupId>
+    <artifactId>ignite-spring-ignite</artifactId>
+    <version>${version}</version>
+</dependency>
+
+<dependency>
+    <groupId>org.apache.ignite</groupId>
+    <artifactId>spring-boot-ignite-client-autoconfigure</artifactId>
+    <version>${version}</version>
+</dependency>
+
+
+----
+--
+
+
+== Application Configuration
+
+To start working with Spring Data, first provide the following properties to 
your application:
+
+[source, text]
+----
+ignite.client.addresses=${ignite.address}
+spring.datasource.url=${ignite.jdbc.connectionString}
+spring.datasource.driver-class-name=org.apache.ignite.jdbc.IgniteJdbcDriver
+----
+
+In the example above:
+
+* Replace `${ignite.address}` with the host and port of your node. For 
example, `localhost:10800`. 
+Replace ${ignite.jdbc.connectionString} with your JDBC connection string, for 
example `jdbc:ignite:thin://localhost`.

Review Comment:
   Should be a list item
   ```suggestion
   * Replace ${ignite.jdbc.connectionString} with your JDBC connection string, 
for example `jdbc:ignite:thin://localhost`.
   ```



##########
docs/_docs/developers-guide/spring-data/spring-data.adoc:
##########
@@ -0,0 +1,173 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+= Apache Ignite With Spring Data
+
+== Overview
+
+Spring Data Framework provides a unified and widely used API that allows 
abstracting an underlying data storage from the
+application layer. Spring Data helps you avoid locking to a specific database 
vendor, making it easy to switch from one
+database to another with minimal efforts. Apache Ignite supports Spring Data 
JDBC by implementing `IgniteDialect`.
+
+== Maven Configuration
+
+The easiest way to start working with Apache Ignite's Spring Data repository 
is by adding the following Maven dependencies
+to the application's `pom.xml` file:
+
+[tabs]
+--
+tab:pom.xml[]
+[source,xml, subs="attributes,specialchars"]]
+----
+<dependency>
+    <groupId>org.apache.ignite</groupId>
+    <artifactId>ignite-spring-ignite</artifactId>
+    <version>${version}</version>
+</dependency>
+
+<dependency>
+    <groupId>org.apache.ignite</groupId>
+    <artifactId>spring-boot-ignite-client-autoconfigure</artifactId>
+    <version>${version}</version>
+</dependency>
+
+
+----
+--
+
+
+== Application Configuration
+
+To start working with Spring Data, first provide the following properties to 
your application:
+
+[source, text]
+----
+ignite.client.addresses=${ignite.address}
+spring.datasource.url=${ignite.jdbc.connectionString}
+spring.datasource.driver-class-name=org.apache.ignite.jdbc.IgniteJdbcDriver
+----
+
+In the example above:
+
+* Replace `${ignite.address}` with the host and port of your node. For 
example, `localhost:10800`. 
+Replace ${ignite.jdbc.connectionString} with your JDBC connection string, for 
example `jdbc:ignite:thin://localhost`.
+
+Here is an example of the application.properties file:
+
+[source, text]
+----
+ignite.client.addresses=127.0.0.1:10800
+spring.datasource.url=jdbc:ignite:thin://localhost
+spring.datasource.driver-class-name=org.apache.ignite.jdbc.IgniteJdbcDriver
+----
+
+You should also provide the `IgniteDialectProvider` parameter by adding the 
following configuration property to the `resources/META-INF/spring.factories` 
(create the
+file if it does not exist):
+
+[source, text]
+----
+org.springframework.data.jdbc.repository.config.DialectResolver$JdbcDialectProvider=org.apache.ignite.data.IgniteDialectProvider
+----
+
+== Creating Repositories
+
+After providing the above configuration, you can create spring repositories.
+For instance, let's create the first custom repository named 
`PersonRepository`:
+
+[tabs]
+--
+tab:Java[]
+[source,java]
+----
+@Repository
+public interface PersonRepository extends IgniteRepository<Person, Long> {
+    /**
+     * Gets all the persons with the given name.
+     * @param name Person name.
+     * @return A list of Persons with the given first name.
+     */
+    public List<Person> findByFirstName(String name);
+
+    /**
+     * Returns top Person with the specified surname.
+     * @param name Person surname.
+     * @return Person that satisfy the query.
+     */
+    public Person findTopByLastNameLike(String name);
+
+    /**
+     * Getting ids of all the Person satisfying the custom query from {@link 
Query} annotation.
+     *
+     * @param orgId Query parameter.
+     * @param pageable Pageable interface.
+     * @return A list of Persons' ids.
+     */
+    @Query("SELECT id FROM Person WHERE orgId > ?")
+    public List<Long> selectId(long orgId, Pageable pageable);
+}
+----
+--
+
+Signatures of custom methods like `findByFirstName(name)` and 
`findTopByLastNameLike(name)` will be automatically processed and turned
+into SQL queries when methods get executed. In addition, `@Query(queryString)` 
annotation can be used if a specific​ SQL
+query needs to be executed as a result of a method call.
+
+
+[CAUTION]
+====
+[discrete]
+A table must exists in the cluster before you start to work with it.

Review Comment:
   ```suggestion
   A table must exist in the cluster before you start to work with it.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to