This is an automated email from the ASF dual-hosted git repository. dmagda pushed a commit to branch IGNITE-7595 in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/IGNITE-7595 by this push: new 22a129c ported the hibernate l2 cache docs 22a129c is described below commit 22a129c9465a5b60e08b0c12d9c91bf7bb7753db Author: Denis Magda <dma...@gridgain.com> AuthorDate: Thu Sep 24 15:00:08 2020 -0700 ported the hibernate l2 cache docs --- docs/_data/toc.yaml | 378 +++++++++++---------- .../hibernate-l2-cache.adoc | 294 ++++++++++++++++ .../ignite-for-spark/ignite-dataframe.adoc | 0 .../ignite-for-spark/ignitecontext-and-rdd.adoc | 0 .../ignite-for-spark/installation.adoc | 0 .../ignite-for-spark/overview.adoc | 0 .../ignite-for-spark/spark-shell.adoc | 0 .../ignite-for-spark/troubleshooting.adoc | 0 .../images/integrations/hibernate-l2-cache.png | Bin 0 -> 135173 bytes 9 files changed, 485 insertions(+), 187 deletions(-) diff --git a/docs/_data/toc.yaml b/docs/_data/toc.yaml index 4bf3950..9489c96 100644 --- a/docs/_data/toc.yaml +++ b/docs/_data/toc.yaml @@ -1,414 +1,418 @@ - title: Preface - url: /preface + url: preface - title: Quick Start Guides items: - title: Java - url: /quick-start/java + url: quick-start/java - title: .NET/C# - url: /quick-start/dotnet + url: quick-start/dotnet - title: C++ - url: /quick-start/cpp + url: quick-start/cpp - title: Python - url: /quick-start/python + url: quick-start/python - title: Node.JS - url: /quick-start/nodejs + url: quick-start/nodejs - title: SQL - url: /quick-start/sql + url: quick-start/sql - title: PHP - url: /quick-start/php + url: quick-start/php - title: REST API - url: /quick-start/restapi + url: quick-start/restapi - title: Installation - url: /installation + url: installation items: - title: Installing Using ZIP Archive - url: /installation/installing-using-zip + url: installation/installing-using-zip - title: Installing Using Docker - url: /installation/installing-using-docker + url: installation/installing-using-docker - title: Installing DEB or RPM package - url: /installation/deb-rpm + url: installation/deb-rpm - title: Kubernetes items: - title: Amazon EKS - url: /installation/kubernetes/amazon-eks-deployment + url: installation/kubernetes/amazon-eks-deployment - title: Azure Kubernetes Service - url: /installation/kubernetes/azure-deployment + url: installation/kubernetes/azure-deployment - title: Google Kubernetes Engine - url: /installation/kubernetes/gke-deployment + url: installation/kubernetes/gke-deployment - title: Setting Up items: - title: Setting Up Ignite for Java - url: /setup + url: setup - title: Setting Up Ignite for .NET/C# - url: /setup-dotnet + url: setup-dotnet - title: Understanding Configuration - url: /understanding-configuration + url: understanding-configuration - title: Configuring Logging - url: /logging + url: logging - title: Starting and Stopping Nodes - url: /starting-nodes + url: starting-nodes - title: Clustering items: - title: Overview - url: /clustering/clustering + url: clustering/clustering - title: TCP/IP Discovery - url: /clustering/tcp-ip-discovery + url: clustering/tcp-ip-discovery - title: ZooKeeper Discovery - url: /clustering/zookeeper-discovery + url: clustering/zookeeper-discovery - title: Discovery in the Cloud - url: /clustering/discovery-in-the-cloud + url: clustering/discovery-in-the-cloud - title: Network Configuration - url: /clustering/network-configuration + url: clustering/network-configuration - title: Connecting Client Nodes - url: /clustering/connect-client-nodes + url: clustering/connect-client-nodes - title: Running Client Nodes Behind NAT - url: /clustering/running-client-nodes-behind-nat + url: clustering/running-client-nodes-behind-nat - title: Data Modeling items: - title: Introduction - url: /data-modeling/data-modeling + url: data-modeling/data-modeling - title: Data Partitioning - url: /data-modeling/data-partitioning + url: data-modeling/data-partitioning - title: Affinity Colocation - url: /data-modeling/affinity-collocation + url: data-modeling/affinity-collocation - title: Configuring Memory items: - title: Memory Architecture - url: /memory-architecture + url: memory-architecture - title: Configuring Data Regions - url: /memory-configuration/data-regions + url: memory-configuration/data-regions - title: Eviction Policies - url: /memory-configuration/eviction-policies + url: memory-configuration/eviction-policies - title: Configuring Caches items: - title: Cache Configuration - url: /configuring-caches/configuration-overview + url: configuring-caches/configuration-overview - title: Configuring Partition Backups - url: /configuring-caches/configuring-backups + url: configuring-caches/configuring-backups - title: Atomicity Modes - url: /configuring-caches/atomicity-modes + url: configuring-caches/atomicity-modes - title: Expiry Policy - url: /configuring-caches/expiry-policies + url: configuring-caches/expiry-policies - title: On-Heap Caching - url: /configuring-caches/on-heap-caching + url: configuring-caches/on-heap-caching - title: Cache Groups - url: /configuring-caches/cache-groups + url: configuring-caches/cache-groups - title: Persistence items: - title: Ignite Persistence - url: /persistence/native-persistence + url: persistence/native-persistence - title: External Storage - url: /persistence/external-storage + url: persistence/external-storage - title: Swapping - url: /persistence/swap + url: persistence/swap - title: Implementing Custom Cache Store - url: /persistence/custom-cache-store + url: persistence/custom-cache-store - title: Cluster Snapshots - url: /persistence/snapshots + url: persistence/snapshots - title: Disk Compression - url: /persistence/disk-compression + url: persistence/disk-compression - title: Tuning Persistence - url: /persistence/persistence-tuning + url: persistence/persistence-tuning - title: Baseline Topology - url: /baseline-topology + url: baseline-topology - title: Cluster States - url: /cluster-states + url: cluster-states - title: Data Rebalancing - url: /data-rebalancing + url: data-rebalancing - title: Partition Loss Policy - url: /partition-loss-policy + url: partition-loss-policy - title: Deploying User Code - url: /deploying-user-code + url: deploying-user-code - title: Peer Class Loading - url: /peer-class-loading + url: peer-class-loading - title: Data Streaming - url: /data-streaming + url: data-streaming - title: Using Key-Value Cache API items: - title: Basic Cache Operations - url: /key-value-api/basic-cache-operations + url: key-value-api/basic-cache-operations - title: Working with Binary Objects - url: /key-value-api/binary-objects + url: key-value-api/binary-objects - title: Using Scan Queries - url: /key-value-api/using-scan-queries + url: key-value-api/using-scan-queries - title: Read Repair - url: /read-repair + url: read-repair - title: Using Continuous Queries - url: /key-value-api/continuous-queries + url: key-value-api/continuous-queries - title: Performing Transactions - url: /key-value-api/transactions + url: key-value-api/transactions - title: Working with SQL items: - title: Introduction - url: /SQL/sql-introduction + url: SQL/sql-introduction - title: Understanding Schemas - url: /SQL/schemas + url: SQL/schemas - title: Defining Indexes - url: /SQL/indexes + url: SQL/indexes - title: Using SQL API - url: /SQL/sql-api + url: SQL/sql-api - title: Distributed Joins - url: /SQL/distributed-joins + url: SQL/distributed-joins - title: SQL Transactions - url: /SQL/sql-transactions + url: SQL/sql-transactions - title: Custom SQL Functions - url: /SQL/custom-sql-func + url: SQL/custom-sql-func - title: JDBC Driver - url: /SQL/JDBC/jdbc-driver + url: SQL/JDBC/jdbc-driver - title: JDBC Client Driver - url: /SQL/JDBC/jdbc-client-driver + url: SQL/JDBC/jdbc-client-driver - title: Multiversion Concurrency Control - url: /transactions/mvcc + url: transactions/mvcc - title: Distributed Computing items: - title: Distributed Computing API - url: /distributed-computing/distributed-computing + url: distributed-computing/distributed-computing - title: Cluster Groups - url: /distributed-computing/cluster-groups + url: distributed-computing/cluster-groups - title: Executor Service - url: /distributed-computing/executor-service + url: distributed-computing/executor-service - title: MapReduce API - url: /distributed-computing/map-reduce + url: distributed-computing/map-reduce - title: Load Balancing - url: /distributed-computing/load-balancing + url: distributed-computing/load-balancing - title: Fault Tolerance - url: /distributed-computing/fault-tolerance + url: distributed-computing/fault-tolerance - title: Job Scheduling - url: /distributed-computing/job-scheduling + url: distributed-computing/job-scheduling - title: Colocating Computations with Data - url: /collocated-computations + url: collocated-computations - title: Working with Events items: - title: Enabling and Listenting to Events - url: /events/listening-to-events + url: events/listening-to-events - title: Events - url: /events/events + url: events/events - title: Near Caches - url: /near-cache + url: near-cache - title: .NET Platform Cache - url: /platform-cache + url: platform-cache - title: Services - url: /services/services + url: services/services - title: Distributed Data Structures items: - title: Queue and Set - url: /data-structures/queue-and-set + url: data-structures/queue-and-set - title: Atomic Types - url: /data-structures/atomic-types + url: data-structures/atomic-types - title: CountDownLatch - url: /data-structures/countdownlatch + url: data-structures/countdownlatch - title: Atomic Sequence - url: /data-structures/atomic-sequence + url: data-structures/atomic-sequence - title: Semaphore - url: /data-structures/semaphore + url: data-structures/semaphore - title: Machine Learning items: - title: Machine Learning - url: /machine-learning/machine-learning + url: machine-learning/machine-learning - title: Partition Based Dataset - url: /machine-learning/partition-based-dataset + url: machine-learning/partition-based-dataset - title: Updating Trained Models - url: /machine-learning/updating-trained-models + url: machine-learning/updating-trained-models - title: Binary Classification items: - title: Introduction - url: /machine-learning/binary-classification/introduction + url: machine-learning/binary-classification/introduction - title: Linear SVM (Support Vector Machine) - url: /machine-learning/binary-classification/linear-svm + url: machine-learning/binary-classification/linear-svm - title: Decision Trees - url: /machine-learning/binary-classification/decision-trees + url: machine-learning/binary-classification/decision-trees - title: Multilayer Perceptron - url: /machine-learning/binary-classification/multilayer-perceptron + url: machine-learning/binary-classification/multilayer-perceptron - title: Logistic Regression - url: /machine-learning/binary-classification/logistic-regression + url: machine-learning/binary-classification/logistic-regression - title: k-NN Classification - url: /machine-learning/binary-classification/knn-classification + url: machine-learning/binary-classification/knn-classification - title: ANN (Approximate Nearest Neighbor) - url: /machine-learning/binary-classification/ann + url: machine-learning/binary-classification/ann - title: Naive Bayes - url: /machine-learning/binary-classification/naive-bayes + url: machine-learning/binary-classification/naive-bayes - title: Regression items: - title: Introduction - url: /machine-learning/regression/introduction + url: machine-learning/regression/introduction - title: Linear Regression - url: /machine-learning/regression/linear-regression + url: machine-learning/regression/linear-regression - title: Decision Trees Regression - url: /machine-learning/regression/decision-trees-regression + url: machine-learning/regression/decision-trees-regression - title: k-NN Regression - url: /machine-learning/regression/knn-regression + url: machine-learning/regression/knn-regression - title: Clustering items: - title: Introduction - url: /machine-learning/clustering/introduction + url: machine-learning/clustering/introduction - title: K-Means Clustering - url: /machine-learning/clustering/k-means-clustering + url: machine-learning/clustering/k-means-clustering - title: Gaussian mixture (GMM) - url: /machine-learning/clustering/gaussian-mixture + url: machine-learning/clustering/gaussian-mixture - title: Preprocessing - url: /machine-learning/preprocessing - - title: Model Selection + url: machine-learning/preprocessing + - title: Model Selection items: - title: Introduction - url: /machine-learning/model-selection/introduction + url: machine-learning/model-selection/introduction - title: Evaluator - url: /machine-learning/model-selection/evaluator + url: machine-learning/model-selection/evaluator - title: Split the dataset on test and train datasets - url: /machine-learning/model-selection/split-the-dataset-on-test-and-train-datasets + url: machine-learning/model-selection/split-the-dataset-on-test-and-train-datasets - title: Hyper-parameter tuning - url: /machine-learning/model-selection/hyper-parameter-tuning + url: machine-learning/model-selection/hyper-parameter-tuning - title: Pipeline API - url: /machine-learning/model-selection/pipeline-api + url: machine-learning/model-selection/pipeline-api - title: Multiclass Classification - url: /machine-learning/multiclass-classification + url: machine-learning/multiclass-classification - title: Ensemble Methods items: - title: - url: /machine-learning/ensemble-methods/introduction + url: machine-learning/ensemble-methods/introduction - title: Stacking - url: /machine-learning/ensemble-methods/stacking + url: machine-learning/ensemble-methods/stacking - title: Bagging - url: /machine-learning/ensemble-methods/baggin + url: machine-learning/ensemble-methods/baggin - title: Random Forest - url: /machine-learning/ensemble-methods/random-forest + url: machine-learning/ensemble-methods/random-forest - title: Gradient Boosting - url: /machine-learning/ensemble-methods/gradient-boosting + url: machine-learning/ensemble-methods/gradient-boosting - title: Recommendation Systems - url: /machine-learning/recommendation-systems + url: machine-learning/recommendation-systems - title: Importing Model items: - title: Introduction - url: /machine-learning/importing-model/introduction + url: machine-learning/importing-model/introduction - title: Import Model from XGBoost - url: /machine-learning/importing-model/model-import-from-gxboost + url: machine-learning/importing-model/model-import-from-gxboost - title: Import Model from Apache Spark - url: /machine-learning/importing-model/model-import-from-apache-spark + url: machine-learning/importing-model/model-import-from-apache-spark - title: Monitoring items: - title: Introduction - url: /monitoring-metrics/intro + url: monitoring-metrics/intro - title: Cluster ID and Tag - url: /monitoring-metrics/cluster-id + url: monitoring-metrics/cluster-id - title: Metrics items: - title: Configuring Metrics - url: /monitoring-metrics/configuring-metrics + url: monitoring-metrics/configuring-metrics - title: JMX Metrics - url: /monitoring-metrics/metrics + url: monitoring-metrics/metrics - title: New Metrics System items: - title: Introduction - url: /monitoring-metrics/new-metrics-system + url: monitoring-metrics/new-metrics-system - title: Metrics - url: /monitoring-metrics/new-metrics + url: monitoring-metrics/new-metrics - title: System Views - url: /monitoring-metrics/system-views + url: monitoring-metrics/system-views - title: Tracing - url: /monitoring-metrics/tracing + url: monitoring-metrics/tracing - title: Security - url: /security + url: security items: - title: Authentication - url: /security/authentication + url: security/authentication - title: SSL/TLS - url: /security/ssl-tls + url: security/ssl-tls - title: Transparent Data Encryption items: - title: Introduction - url: /security/tde + url: security/tde - title: Master key rotation - url: /security/master-key-rotation + url: security/master-key-rotation - title: Sandbox - url: /security/sandbox + url: security/sandbox - title: Thin Clients items: - title: Thin Clients Overview - url: /thin-clients/getting-started-with-thin-clients + url: thin-clients/getting-started-with-thin-clients - title: Java Thin Client - url: /thin-clients/java-thin-client + url: thin-clients/java-thin-client - title: .NET Thin Client - url: /thin-clients/dotnet-thin-client + url: thin-clients/dotnet-thin-client - title: C++ Thin Client - url: /thin-clients/cpp-thin-client + url: thin-clients/cpp-thin-client - title: Python Thin Client - url: /thin-clients/python-thin-client + url: thin-clients/python-thin-client - title: PHP Thin Client - url: /thin-clients/php-thin-client + url: thin-clients/php-thin-client - title: Node.js Thin Client - url: /thin-clients/nodejs-thin-client + url: thin-clients/nodejs-thin-client - title: Binary Client Protocol items: - title: Binary Client Protocol - url: /binary-client-protocol/binary-client-protocol + url: binary-client-protocol/binary-client-protocol - title: Data Format - url: /binary-client-protocol/data-format + url: binary-client-protocol/data-format - title: Key-Value Queries - url: /binary-client-protocol/key-value-queries + url: binary-client-protocol/key-value-queries - title: SQL and Scan Queries - url: /binary-client-protocol/sql-and-scan-queries + url: binary-client-protocol/sql-and-scan-queries - title: Binary Types Metadata - url: /binary-client-protocol/binary-type-metadata + url: binary-client-protocol/binary-type-metadata - title: Cache Configuration - url: /binary-client-protocol/cache-configuration + url: binary-client-protocol/cache-configuration - title: ODBC Driver items: - title: ODBC Driver - url: /SQL/ODBC/odbc-driver + url: SQL/ODBC/odbc-driver - title: Connection String and DSN url: /SQL/ODBC/connection-string-dsn - title: Querying and Modifying Data - url: /SQL/ODBC/querying-modifying-data + url: SQL/ODBC/querying-modifying-data - title: Specification - url: /SQL/ODBC/specification + url: SQL/ODBC/specification - title: Data Types - url: /SQL/ODBC/data-types + url: SQL/ODBC/data-types - title: Error Codes - url: /SQL/ODBC/error-codes + url: SQL/ODBC/error-codes - title: REST API - url: /restapi + url: restapi - title: Control Script - url: /control-script -- title: Plugins - url: /plugins -- title: SQLLine - url: /sqlline -- title: Ignite for Spark - items: - - title: Overview - url: /ignite-for-spark/overview - - title: IgniteContext and IgniteRDD - url: /ignite-for-spark/ignitecontext-and-rdd - - title: Ignite DataFrame - url: /ignite-for-spark/ignite-dataframe - - title: Installation - url: /ignite-for-spark/installation - - title: Test Ignite with Spark-shell - url: /ignite-for-spark/spark-shell - - title: Troubleshooting - url: /ignite-for-spark/troubleshooting + url: control-script +- title: SQLLine + url: sqlline +- title: Extensions and Integrations + items: + - title: Ignite for Spark + items: + - title: Overview + url: extensions-and-integrations/ignite-for-spark/overview + - title: IgniteContext and IgniteRDD + url: extensions-and-integrations/ignite-for-spark/ignitecontext-and-rdd + - title: Ignite DataFrame + url: extensions-and-integrations/ignite-for-spark/ignite-dataframe + - title: Installation + url: extensions-and-integrations/ignite-for-spark/installation + - title: Test Ignite with Spark-shell + url: extensions-and-integrations/ignite-for-spark/spark-shell + - title: Troubleshooting + url: extensions-and-integrations/ignite-for-spark/troubleshooting + - title: Hibernate L2 Cache + url: extensions-and-integrations/hibernate-l2-cache +- title: Plugins + url: plugins - title: SQL Reference - url: /sql-reference/sql-reference-overview + url: sql-reference/sql-reference-overview items: - title: SQL Conformance - url: /sql-reference/sql-conformance + url: sql-reference/sql-conformance - title: Data Definition Language (DDL) - url: /sql-reference/ddl + url: sql-reference/ddl - title: Data Manipulation Language (DML) - url: /sql-reference/dml + url: sql-reference/dml - title: Transactions - url: /sql-reference/transactions + url: sql-reference/transactions - title: Operational Commands - url: /sql-reference/operational-commands + url: sql-reference/operational-commands - title: Aggregate functions - url: /sql-reference/aggregate-functions + url: sql-reference/aggregate-functions - title: Numeric Functions - url: /sql-reference/numeric-functions + url: sql-reference/numeric-functions - title: String Functions - url: /sql-reference/string-functions + url: sql-reference/string-functions - title: Data and Time Functions - url: /sql-reference/date-time-functions + url: sql-reference/date-time-functions - title: System Functions - url: /sql-reference/system-functions + url: sql-reference/system-functions - title: Data Types - url: /sql-reference/data-types + url: sql-reference/data-types diff --git a/docs/_docs/extensions-and-integrations/hibernate-l2-cache.adoc b/docs/_docs/extensions-and-integrations/hibernate-l2-cache.adoc new file mode 100644 index 0000000..f33b210 --- /dev/null +++ b/docs/_docs/extensions-and-integrations/hibernate-l2-cache.adoc @@ -0,0 +1,294 @@ += Apache Ignite Hibernate L2 Cache + +== Overview + +Apache Ignite can be used as a http://hibernate.org[Hibernate, window=_blank] second-Level cache, +which can significantly speed-up the persistence layer of your application. + +All work with Hibernate database-mapped objects is done within a session, usually bound to a worker thread or a Web session. +By default, Hibernate only uses per-session (L1) cache, so, objects, cached in one session, are not seen in another. +However, an L2 cache may be used, in which the cached objects are seen for all sessions that use +the same L2 cache configuration. This usually gives a significantly greater performance gain, because each newly-created +session can take full advantage of the data already present in L2 cache memory (which outlives any session-local L1 cache). + +image::images/integrations/hibernate-l2-cache.png[Ignite Cluster] + +While the L1 cache is always enabled and fully implemented by Hibernate internally, L2 cache is optional and can have +multiple pluggable implementaions. Ignite can be easily plugged-in as an L2 cache implementation, and can be used in all +access modes (`READ_ONLY`, `READ_WRITE`, `NONSTRICT_READ_WRITE`, and `TRANSACTIONAL`), supporting a wide range of related features: + +* caching to memory and disk, as well as off-heap memory. +* cache transactions, that make `TRANSACTIONAL` mode possible. +* clustering, with 2 different replication modes: `REPLICATED` and `PARTITIONED` + +To start using GridGain as a Hibernate L2 cache, you need to perform 3 simple steps: + +* Add Ignite libraries to your application's classpath. +* Enable L2 cache and specify Ignite implementation class in L2 cache configuration. +* Configure Ignite caches for L2 cache regions and start the embedded Ignite node (and, optionally, external Ignite nodes). + +In the section below we cover these steps in more detail. + +== L2 Cache Configuration + +To configure Ignite with as a Hibernate L2 cache, without any changes required to the existing Hibernate code, you need to: + +* Add either `ignite-hibernate_5.3` or `ignite-hibernate_4.2` module as a dependency to your project depending on whether +Hibernate 5 or Hibernate 4 is used. Alternatively, you can copy JAR files of the same name from +`+{apache_ignite_relese}/libs/optional+` to `+{apache_ignite_relese}/libs+` folder if you start an Apache Ignite node +from a command line. +* Configure Hibernate itself to use Ignite as an L2 cache. +* Configure Ignite caches appropriately. + +=== Maven Configuration + +To add Apache Ignite Hibernate integration to your project, add the following dependency to your pom.xml file: + +[tabs] +-- +tab:Hibernate 5[] +[source,xml] +---- +<dependency> + <groupId>org.apache.ignite</groupId> + <artifactId>ignite-hibernate_5.3</artifactId> + <version>${ignite.version}</version> +</dependency> +---- +tab:Hibernate 4[] +[source,xml] +---- +<dependency> + <groupId>org.apache.ignite</groupId> + <artifactId>ignite-hibernate_4.2</artifactId> + <version>${ignite.version}</version> +</dependency> +---- +-- + +=== Hibernate Configuration Example + +A typical Hibernate configuration for L2 cache with Ignite would look like the one below: + +[tabs] +-- +tab:XML[] +[source,xml] +---- +<hibernate-configuration> + <session-factory> + ... + <!-- Enable L2 cache. --> + <property name="cache.use_second_level_cache">true</property> + + <!-- Generate L2 cache statistics. --> + <property name="generate_statistics">true</property> + + <!-- Specify Ignite as L2 cache provider. --> + <property name="cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</property> + + <!-- Specify the name of the grid, that will be used for second level caching. --> + <property name="org.apache.ignite.hibernate.ignite_instance_name">hibernate-grid</property> + + <!-- Set default L2 cache access type. --> + <property name="org.apache.ignite.hibernate.default_access_type">READ_ONLY</property> + + <!-- Specify the entity classes for mapping. --> + <mapping class="com.mycompany.MyEntity1"/> + <mapping class="com.mycompany.MyEntity2"/> + + <!-- Per-class L2 cache settings. --> + <class-cache class="com.mycompany.MyEntity1" usage="read-only"/> + <class-cache class="com.mycompany.MyEntity2" usage="read-only"/> + <collection-cache collection="com.mycompany.MyEntity1.children" usage="read-only"/> + ... + </session-factory> +</hibernate-configuration> +---- +-- + +Here, we do the following: + +* Enable L2 cache (and, optionally, the L2 cache statistics generation). +* Specify Ignite as L2 cache implementation. +* Specify the name of the caching grid (should correspond to the one in Ignite configuration). +* Specify the entity classes and configure caching for each class (a corresponding cache region should be configured in Ignite). + +=== Ignite Configuration Example +A typical Ignite configuration for Hibernate L2 caching looks like this: + +[tabs] +-- +tab:XML[] +[source,xml] +---- +<!-- Basic configuration for atomic cache. --> +<bean id="atomic-cache" class="org.apache.ignite.configuration.CacheConfiguration" abstract="true"> + <property name="cacheMode" value="PARTITIONED"/> + <property name="atomicityMode" value="ATOMIC"/> + <property name="writeSynchronizationMode" value="FULL_SYNC"/> +</bean> + +<!-- Basic configuration for transactional cache. --> +<bean id="transactional-cache" class="org.apache.ignite.configuration.CacheConfiguration" abstract="true"> + <property name="cacheMode" value="PARTITIONED"/> + <property name="atomicityMode" value="TRANSACTIONAL"/> + <property name="writeSynchronizationMode" value="FULL_SYNC"/> +</bean> + +<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> + <!-- + Specify the name of the caching grid (should correspond to the + one in Hibernate configuration). + --> + <property name="igniteInstanceName" value="hibernate-grid"/> + ... + <!-- + Specify cache configuration for each L2 cache region (which corresponds + to a full class name or a full association name). + --> + <property name="cacheConfiguration"> + <list> + <!-- + Configurations for entity caches. + --> + <bean parent="transactional-cache"> + <property name="name" value="com.mycompany.MyEntity1"/> + </bean> + <bean parent="transactional-cache"> + <property name="name" value="com.mycompany.MyEntity2"/> + </bean> + <bean parent="transactional-cache"> + <property name="name" value="com.mycompany.MyEntity1.children"/> + </bean> + + <!-- Configuration for update timestamps cache. --> + <bean parent="atomic-cache"> + <property name="name" value="org.hibernate.cache.spi.UpdateTimestampsCache"/> + </bean> + + <!-- Configuration for query result cache. --> + <bean parent="atomic-cache"> + <property name="name" value="org.hibernate.cache.internal.StandardQueryCache"/> + </bean> + </list> + </property> + ... +</bean> +---- +-- + +Here, we specify the cache configuration for each L2 cache region: + +* We use `PARTITIONED` cache to split the data between caching nodes. Another possible strategy is to enable `REPLICATED` mode, +thus replicating a full dataset between all caching nodes. See Cache Distribution Models for more information. +* We specify the cache name that corresponds an L2 cache region name (either a full class name or a full association name). +* We use `TRANSACTIONAL` atomicity mode to take advantage of cache transactions. +* We enable `FULL_SYNC` to be always fully synchronized with backup nodes. + +Additionally, we specify a cache for update timestamps, which may be `ATOMIC`, for better performance. + +Having configured Ignite caching node, we can start it from within our code the following way: + +[tabs] +-- +tab:Java[] +[source,java] +---- +Ignition.start("my-config-folder/my-ignite-configuration.xml"); +---- +-- + +After the above line is executed, the internal Ignite node is started and is ready to cache the data. We can also start +additional standalone nodes by running the following command from console: + +[tabs] +-- +tab:Unix[] +[source,shell] +---- +$IGNITE_HOME/bin/ignite.sh my-config-folder/my-ignite-configuration.xml +---- +tab:Windows[] +[source,shell] +---- +$IGNITE_HOME\bin\ignite.bat my-config-folder\my-ignite-configuration.xml +---- +-- + +[NOTE] +==== +The nodes may be started on other hosts as well, forming a distributed caching cluster. +Be sure to specify the right network settings in GridGain configuration file for that. +==== + +== Query Cache + +In addition to L2 cache, Hibernate offers a query cache. This cache stores the results of queries (either HQL or Criteria) +with a given set of parameters, so, when you repeat the query with the same parameter set, it hits the cache without going to the database. + +Query cache may be useful if you have a number of queries, which may repeat with the same parameter values. +Like in case of L2 cache, Hibernate relies on a 3-rd party cache implementation, and Ignite can be used as such. + +== Query Cache Configuration + +The configuration information above totally applies to query cache, but some additional configuration and code change is required. + +=== Hibernate Configuration +To enable query cache in Hibernate, you only need one additional line in configuration file: + +[tabs] +-- +tab:XML[] +[source,xml] +---- +<!-- Enable query cache. --> +<property name="cache.use_query_cache">true</property> +---- +-- + +Yet, a code modification is required: for each query that you want to cache, you should enable `cacheable` flag by calling `setCacheable(true)`: + +[tabs] +-- +tab:Java[] +[source,java] +---- +Session ses = ...; + +// Create Criteria query. +Criteria criteria = ses.createCriteria(cls); + +// Enable cacheable flag. +criteria.setCacheable(true); + +... +---- +-- + +After this is done, your query results will be cached. + +=== Ignite Configuration +To enable Hibernate query caching in Ignite, you need to specify an additional cache configuration: + +[tabs] +-- +tab:XML[] +[source,xml] +---- +<property name="cacheConfiguration"> + <list> + ... + <!-- Query cache (refers to atomic cache defined in above example). --> + <bean parent="atomic-cache"> + <property name="name" value="org.hibernate.cache.internal.StandardQueryCache"/> + </bean> + </list> +</property> +---- +-- + +== Example + +See a complete https://github.com/apache/ignite/blob/master/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java[example, window=_blank] +that is available on GitHub and in every Apache Ignite distribution. diff --git a/docs/_docs/ignite-for-spark/ignite-dataframe.adoc b/docs/_docs/extensions-and-integrations/ignite-for-spark/ignite-dataframe.adoc similarity index 100% rename from docs/_docs/ignite-for-spark/ignite-dataframe.adoc rename to docs/_docs/extensions-and-integrations/ignite-for-spark/ignite-dataframe.adoc diff --git a/docs/_docs/ignite-for-spark/ignitecontext-and-rdd.adoc b/docs/_docs/extensions-and-integrations/ignite-for-spark/ignitecontext-and-rdd.adoc similarity index 100% rename from docs/_docs/ignite-for-spark/ignitecontext-and-rdd.adoc rename to docs/_docs/extensions-and-integrations/ignite-for-spark/ignitecontext-and-rdd.adoc diff --git a/docs/_docs/ignite-for-spark/installation.adoc b/docs/_docs/extensions-and-integrations/ignite-for-spark/installation.adoc similarity index 100% rename from docs/_docs/ignite-for-spark/installation.adoc rename to docs/_docs/extensions-and-integrations/ignite-for-spark/installation.adoc diff --git a/docs/_docs/ignite-for-spark/overview.adoc b/docs/_docs/extensions-and-integrations/ignite-for-spark/overview.adoc similarity index 100% rename from docs/_docs/ignite-for-spark/overview.adoc rename to docs/_docs/extensions-and-integrations/ignite-for-spark/overview.adoc diff --git a/docs/_docs/ignite-for-spark/spark-shell.adoc b/docs/_docs/extensions-and-integrations/ignite-for-spark/spark-shell.adoc similarity index 100% rename from docs/_docs/ignite-for-spark/spark-shell.adoc rename to docs/_docs/extensions-and-integrations/ignite-for-spark/spark-shell.adoc diff --git a/docs/_docs/ignite-for-spark/troubleshooting.adoc b/docs/_docs/extensions-and-integrations/ignite-for-spark/troubleshooting.adoc similarity index 100% rename from docs/_docs/ignite-for-spark/troubleshooting.adoc rename to docs/_docs/extensions-and-integrations/ignite-for-spark/troubleshooting.adoc diff --git a/docs/_docs/images/integrations/hibernate-l2-cache.png b/docs/_docs/images/integrations/hibernate-l2-cache.png new file mode 100644 index 0000000..42f83c5 Binary files /dev/null and b/docs/_docs/images/integrations/hibernate-l2-cache.png differ