You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/10/27 10:16:55 UTC

[04/10] ignite git commit: IGNITE-1653

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
deleted file mode 100644
index 035ab98..0000000
--- a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-
-<!DOCTYPE hibernate-mapping PUBLIC
-        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping default-access="field">
-    <class name="org.apache.ignite.examples.datagrid.store.Person" table="PERSONS">
-        <!-- ID. -->
-        <id name="id"/>
-
-        <!-- We only map data we are interested in. -->
-        <property name="firstName"/>
-        <property name="lastName"/>
-    </class>
-</hibernate-mapping>

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
deleted file mode 100644
index 80a43e7..0000000
--- a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-
-<!--
-  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.
--->
-
-<!DOCTYPE hibernate-configuration PUBLIC
-        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
-
-<!--
-    Hibernate configuration.
--->
-<hibernate-configuration>
-    <session-factory>
-        <!-- Database connection settings (private in-memory database). -->
-        <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
-
-        <!-- Only validate the database schema on startup in production mode. -->
-        <property name="hbm2ddl.auto">update</property>
-
-        <!-- Do not output SQL. -->
-        <property name="show_sql">false</property>
-
-        <!-- Mappings. -->
-        <mapping resource="org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml"/>
-    </session-factory>
-</hibernate-configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java
deleted file mode 100644
index 7210b49..0000000
--- a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * <!-- Package description. -->
- * Contains Hibernate-based cache store implementation.
- */
-package org.apache.ignite.examples.datagrid.store.hibernate;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java
deleted file mode 100644
index f8d0660..0000000
--- a/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.examples.misc.schedule;
-
-import java.util.concurrent.Callable;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.examples.ExampleNodeStartup;
-import org.apache.ignite.lang.IgniteRunnable;
-import org.apache.ignite.scheduler.SchedulerFuture;
-
-/**
- * Demonstrates a cron-based {@link Runnable} execution scheduling.
- * Test runnable object broadcasts a phrase to all cluster nodes every minute
- * three times with initial scheduling delay equal to five seconds.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
- * <p>
- * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
- * with {@code examples/config/example-ignite.xml} configuration.
- */
-public class ComputeScheduleExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     * @throws IgniteException If example execution failed.
-     */
-    public static void main(String[] args) throws IgniteException {
-        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
-            System.out.println();
-            System.out.println("Compute schedule example started.");
-
-            // Schedule output message every minute.
-            SchedulerFuture<?> fut = ignite.scheduler().scheduleLocal(
-                new Callable<Integer>() {
-                    private int invocations;
-
-                    @Override public Integer call() {
-                        invocations++;
-
-                        ignite.compute().broadcast(
-                            new IgniteRunnable() {
-                                @Override public void run() {
-                                    System.out.println();
-                                    System.out.println("Howdy! :)");
-                                }
-                            }
-                        );
-
-                        return invocations;
-                    }
-                },
-                "{5, 3} * * * * *" // Cron expression.
-            );
-
-            while (!fut.isDone())
-                System.out.println(">>> Invocation #: " + fut.get());
-
-            System.out.println();
-            System.out.println(">>> Schedule future is done and has been unscheduled.");
-            System.out.println(">>> Check all nodes for hello message output.");
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java
deleted file mode 100644
index 6602a6e..0000000
--- a/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * <!-- Package description. -->
- * Demonstrates usage of cron-based scheduler.
- */
-package org.apache.ignite.examples.misc.schedule;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java
deleted file mode 100644
index c250638..0000000
--- a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.examples.java8.misc.schedule;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.examples.ExampleNodeStartup;
-import org.apache.ignite.scheduler.SchedulerFuture;
-
-/**
- * Demonstrates a cron-based {@link Runnable} execution scheduling.
- * Test runnable object broadcasts a phrase to all cluster nodes every minute
- * three times with initial scheduling delay equal to five seconds.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
- * <p>
- * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
- * with {@code examples/config/example-ignite.xml} configuration.
- */
-public class ComputeScheduleExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     * @throws IgniteException If example execution failed.
-     */
-    public static void main(String[] args) throws IgniteException {
-        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
-            System.out.println();
-            System.out.println("Compute schedule example started.");
-
-            // Schedule output message every minute.
-            SchedulerFuture<?> fut = ignite.scheduler().scheduleLocal(() ->
-                ignite.compute().broadcast(() -> {
-                    System.out.println();
-                    System.out.println("Howdy! :)");
-
-                    return "Howdy! :)";
-                }),
-                "{5, 3} * * * * *" // Cron expression.
-            );
-
-            while (!fut.isDone())
-                System.out.println(">>> Invocation result: " + fut.get());
-
-            System.out.println();
-            System.out.println(">>> Schedule future is done and has been unscheduled.");
-            System.out.println(">>> Check all nodes for hello message output.");
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java
deleted file mode 100644
index 5855994..0000000
--- a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * <!-- Package description. -->
- * Demonstrates usage of cron-based scheduler.
- */
-package org.apache.ignite.examples.java8.misc.schedule;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/package-info.java
deleted file mode 100644
index 66847dc..0000000
--- a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *  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.
- */
-
-/**
- * <!-- Package description. -->
- * Basic examples for ignite functionality utilizing Java8 lambdas.
- * Use "java8" examples with JDK8 in addition to the "java" examples.
- */
-package org.apache.ignite.examples.java8;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala b/examples-lgpl/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
deleted file mode 100644
index 8734a23..0000000
--- a/examples-lgpl/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.scalar.examples
-
-import org.apache.ignite.scalar.scalar
-import org.apache.ignite.scalar.scalar._
-
-/**
- * Demonstrates a cron-based `Runnable` execution scheduling.
- * Test runnable object broadcasts a phrase to all cluster nodes every minute
- * three times with initial scheduling delay equal to five seconds.
- * <p/>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: `'ignite.{sh|bat} examples/config/example-ignite.xml'`.
- * <p/>
- * Alternatively you can run `ExampleNodeStartup` in another JVM which will
- * start node with `examples/config/example-ignite.xml` configuration.
- */
-object ScalarScheduleExample extends App {
-    scalar("examples/config/example-ignite.xml") {
-        println()
-        println("Compute schedule example started.")
-
-        val g = ignite$
-
-        var invocations = 0
-
-        // Schedule callable that returns incremented value each time.
-        val fut = ignite$.scheduleLocalCall(
-            () => {
-                invocations += 1
-
-                g.bcastRun(() => {
-                    println()
-                    println("Howdy! :)")
-                }, null)
-
-                invocations
-            },
-            "{5, 3} * * * * *" // Cron expression.
-        )
-
-        while (!fut.isDone)
-            println(">>> Invocation #: " + fut.get)
-
-        // Prints.
-        println()
-        println(">>> Schedule future is done and has been unscheduled.")
-        println(">>> Check all nodes for hello message output.")
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java b/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
deleted file mode 100644
index 8a40d4a..0000000
--- a/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.examples;
-
-import org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample;
-
-/**
- * Multi-node test for {@link HibernateL2CacheExample}.
- */
-public class HibernateL2CacheExampleMultiNodeSelfTest extends HibernateL2CacheExampleSelfTest {
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        for (int i = 0; i < RMT_NODES_CNT; i++)
-            startGrid("node-" + i, "examples/config/example-ignite.xml");
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java b/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java
deleted file mode 100644
index 68767d7..0000000
--- a/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.examples;
-
-import org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-
-/**
- * Tests the {@link HibernateL2CacheExample}.
- */
-public class HibernateL2CacheExampleSelfTest extends GridAbstractExamplesTest {
-    /**
-     * @throws Exception If failed.
-     */
-    public void testHibernateL2CacheExample() throws Exception {
-        HibernateL2CacheExample.main(EMPTY_ARGS);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/test/java/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java b/examples-lgpl/src/test/java/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java
deleted file mode 100644
index 7c99712..0000000
--- a/examples-lgpl/src/test/java/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  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.
- */
-
-package org.apache.ignite.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.examples.HibernateL2CacheExampleMultiNodeSelfTest;
-import org.apache.ignite.examples.HibernateL2CacheExampleSelfTest;
-import org.apache.ignite.testframework.GridTestUtils;
-
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_OVERRIDE_MCAST_GRP;
-
-/**
- * Examples test suite. <p> Contains only Spring ignite examples tests.
- */
-public class IgniteLgplExamplesSelfTestSuite extends TestSuite {
-    /**
-     * @return Suite.
-     * @throws Exception If failed.
-     */
-    public static TestSuite suite() throws Exception {
-        System.setProperty(IGNITE_OVERRIDE_MCAST_GRP,
-            GridTestUtils.getNextMulticastGroup(IgniteLgplExamplesSelfTestSuite.class));
-
-        TestSuite suite = new TestSuite("Ignite Examples Test Suite");
-
-        suite.addTest(new TestSuite(HibernateL2CacheExampleSelfTest.class));
-
-        // Multi-node.
-        suite.addTest(new TestSuite(HibernateL2CacheExampleMultiNodeSelfTest.class));
-
-        return suite;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java b/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
deleted file mode 100644
index edfba3d..0000000
--- a/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.java8.examples;
-
-/**
- * Multi-node test for {@link org.apache.ignite.examples.java8.datagrid.hibernate.HibernateL2CacheExample}.
- */
-public class HibernateL2CacheExampleMultiNodeSelfTest extends HibernateL2CacheExampleSelfTest {
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        for (int i = 0; i < RMT_NODES_CNT; i++)
-            startGrid("node-" + i, "examples/config/example-ignite.xml");
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java b/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java
deleted file mode 100644
index 8c7a2de..0000000
--- a/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.java8.examples;
-
-//import org.apache.ignite.examples.java8.datagrid.hibernate.*;
-
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-
-/**
- * Tests the {@link org.apache.ignite.examples.java8.datagrid.hibernate.HibernateL2CacheExample}.
- */
-public class HibernateL2CacheExampleSelfTest extends GridAbstractExamplesTest {
-    /**
-     * TODO: IGNITE-711 next example(s) should be implemented for java 8
-     * or testing method(s) should be removed if example(s) does not applicable for java 8.
-     *
-     * @throws Exception If failed.
-     */
-//    public void testHibernateL2CacheExample() throws Exception {
-//        HibernateL2CacheExample.main(EMPTY_ARGS);
-//    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/test/java8/org/apache/ignite/java8/testsuites/IgniteLgplExamplesJ8SelfTestSuite.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java8/org/apache/ignite/java8/testsuites/IgniteLgplExamplesJ8SelfTestSuite.java b/examples-lgpl/src/test/java8/org/apache/ignite/java8/testsuites/IgniteLgplExamplesJ8SelfTestSuite.java
deleted file mode 100644
index bdda5f6..0000000
--- a/examples-lgpl/src/test/java8/org/apache/ignite/java8/testsuites/IgniteLgplExamplesJ8SelfTestSuite.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  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.
- */
-
-package org.apache.ignite.java8.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.testframework.GridTestUtils;
-
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_OVERRIDE_MCAST_GRP;
-
-/**
- * Examples test suite. <p> Contains only Spring ignite examples tests.
- */
-public class IgniteLgplExamplesJ8SelfTestSuite extends TestSuite {
-    /**
-     * @return Suite.
-     * @throws Exception If failed.
-     */
-    public static TestSuite suite() throws Exception {
-        System.setProperty(IGNITE_OVERRIDE_MCAST_GRP,
-            GridTestUtils.getNextMulticastGroup(IgniteLgplExamplesJ8SelfTestSuite.class));
-
-        TestSuite suite = new TestSuite("Ignite Examples Test Suite");
-
-//        suite.addTest(new TestSuite(HibernateL2CacheExampleSelfTest.class));
-
-        // Multi-node.
-//        suite.addTest(new TestSuite(HibernateL2CacheExampleMultiNodeSelfTest.class));
-
-        return suite;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesMultiNodeSelfTest.scala
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesMultiNodeSelfTest.scala b/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesMultiNodeSelfTest.scala
deleted file mode 100644
index fca44e3..0000000
--- a/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesMultiNodeSelfTest.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  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.
- */
-
-package org.apache.ignite.scalar.tests.examples
-
-/**
- * Scalar examples multi-node self test.
- */
-class ScalarLgplExamplesMultiNodeSelfTest extends ScalarExamplesSelfTest {
-    /** */
-    protected override def beforeTest() {
-        startRemoteNodes()
-    }
-
-    /** */
-    protected override def getTestTimeout: Long = {
-        10 * 60 * 1000
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesSelfTest.scala
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesSelfTest.scala b/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesSelfTest.scala
deleted file mode 100644
index 25a5fe4..0000000
--- a/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesSelfTest.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  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.
- */
-
-package org.apache.ignite.scalar.tests.examples
-
-import org.apache.ignite.scalar.examples._
-import org.apache.ignite.scalar.scalar
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest
-import org.scalatest.junit.JUnitSuiteLike
-
-/**
- * Scalar examples self test.
- */
-class ScalarLgplExamplesSelfTest extends GridAbstractExamplesTest with JUnitSuiteLike {
-    /** */
-    private def EMPTY_ARGS = Array.empty[String]
-
-    /** */
-    def testScalarScheduleCallableExample() {
-        ScalarScheduleExample.main(EMPTY_ARGS)
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples-lgpl/src/test/scala/org/apache/ignite/scalar/testsuites/ScalarLgplExamplesSelfTestSuite.scala
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/scala/org/apache/ignite/scalar/testsuites/ScalarLgplExamplesSelfTestSuite.scala b/examples-lgpl/src/test/scala/org/apache/ignite/scalar/testsuites/ScalarLgplExamplesSelfTestSuite.scala
deleted file mode 100644
index 4f3195e..0000000
--- a/examples-lgpl/src/test/scala/org/apache/ignite/scalar/testsuites/ScalarLgplExamplesSelfTestSuite.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  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.
- */
-
-package org.apache.ignite.scalar.testsuites
-
-import org.apache.ignite.IgniteSystemProperties._
-import org.apache.ignite.scalar.tests.examples.{ScalarExamplesMultiNodeSelfTest, ScalarExamplesSelfTest}
-import org.apache.ignite.testframework.GridTestUtils
-import org.junit.runner.RunWith
-import org.scalatest._
-import org.scalatest.junit.JUnitRunner
-
-/**
- *
- */
-@RunWith(classOf[JUnitRunner])
-class ScalarLgplExamplesSelfTestSuite extends Suites(
-    new ScalarLgplExamplesSelfTest,
-    new ScalarLgplExamplesMultiNodeSelfTest
-) {
-    System.setProperty(IGNITE_OVERRIDE_MCAST_GRP,
-        GridTestUtils.getNextMulticastGroup(classOf[ScalarLgplExamplesSelfTest]))
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples/README-LGPL.txt
----------------------------------------------------------------------
diff --git a/examples/README-LGPL.txt b/examples/README-LGPL.txt
new file mode 100644
index 0000000..0f95971
--- /dev/null
+++ b/examples/README-LGPL.txt
@@ -0,0 +1,33 @@
+Apache Ignite Examples
+======================
+
+This folder contains code examples for various Apache Ignite functionality.
+
+Examples are shipped as a separate Maven project, so to start running you simply need
+to import provided `pom.xml` file into your favourite IDE.
+
+The examples folder contains he following subfolders:
+
+- `config` - contains Ignite configuration files needed for examples.
+- `memcached` - contains PHP script demonstrating how Ignite Cache can be accessed using Memcached client.
+- `rest` - contains PHP script demonstrating how Ignite Cache can be accessed via HTTP API.
+- `schema-import` - contains demo project for Apache Ignite Schema Import Utility. Refer to enclosed
+  README.txt file for more information on how to build and run the demo.
+- `src/main/java` - contains Java examples for different Ignite modules and features.
+- `src/main/java8` - contains additional set of Java examples utilizing Java 8 lambdas. These examples
+  are excluded by default, enable `java8` Maven profile to include them (JDK8 is required).
+- `src/main/scala` - contains examples demonstrating usage of API provided by Scalar.
+- `src/main/java-lgpl` - contains lgpl-based examples for different Ignite modules and features.
+
+
+Starting Remote Nodes
+=====================
+
+Remote nodes for examples should always be started with special configuration file which enables P2P
+class loading: `examples/config/example-ignite.xml`. To run a remote node in IDE use `ExampleNodeStartup` class.
+
+
+Java7 vs Java8
+===============
+Some examples (not all) which can benefit from Java8 Lambda support were re-written with Java8 lambdas.
+For full set of examples, look at both Java7 and Java8 packages.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples/README.txt
----------------------------------------------------------------------
diff --git a/examples/README.txt b/examples/README.txt
index ed26b81..26970d6 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -15,8 +15,9 @@ The examples folder contains he following subfolders:
   README.txt file for more information on how to build and run the demo.
 - `src/main/java` - contains Java examples for different Ignite modules and features.
 - `src/main/java8` - contains additional set of Java examples utilizing Java 8 lambdas. These examples
-  are excluded by default, enable `java8-examples` Maven profile to include them (JDK8 is required).
+  are excluded by default, enable `java8` Maven profile to include them (JDK8 is required).
 - `src/main/scala` - contains examples demonstrating usage of API provided by Scalar.
+- `src/main/java-lgpl` - contains lgpl-based examples for different Ignite modules and features.
 
 
 Starting Remote Nodes
@@ -30,3 +31,21 @@ Java7 vs Java8
 ===============
 Some examples (not all) which can benefit from Java8 Lambda support were re-written with Java8 lambdas.
 For full set of examples, look at both Java7 and Java8 packages.
+
+
+LGPL
+=====
+LGPL examples can be activated by turning lgpl profile on.
+
+lgpl profile required some lgpl-based libs, for example: ignite-hibernate & ignite-schedule.
+In case these libs can not be found by this maven project please download Apache Ignite sources
+at https://ignite.apache.org/download.cgi#sources.
+
+There are some ways to gain required libs from sources:
+
+1) Run "mvn clean install -DskipTests -P lgpl" at Apache Ignite sources.
+This case will install lgpl-based libs to local maven repository.
+
+2) Run "mvn clean package -DskipTests -Prelease,lgpl -Dignite.edition=fabric-lgpl" at Apache Ignite sources.
+Required libs will appear at /target/release-package/libs/optional subfolders.
+Found libs should be copied to global or project's classpath.

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples/config/hibernate/README.txt
----------------------------------------------------------------------
diff --git a/examples/config/hibernate/README.txt b/examples/config/hibernate/README.txt
new file mode 100644
index 0000000..5b7ab29
--- /dev/null
+++ b/examples/config/hibernate/README.txt
@@ -0,0 +1,8 @@
+Hibernate L2 Cache Configuration Example
+----------------------------------------
+
+This folder contains example-hibernate-L2-cache.xml file that demonstrates
+how to configure Hibernate to use Apache Ignite cache as an L2 cache provider.
+
+This file is also used in Hibernate example located in org.apache.ignite.examples.datagrid.hibernate
+package.

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples/config/hibernate/example-hibernate-L2-cache.xml
----------------------------------------------------------------------
diff --git a/examples/config/hibernate/example-hibernate-L2-cache.xml b/examples/config/hibernate/example-hibernate-L2-cache.xml
new file mode 100644
index 0000000..a2f7e89
--- /dev/null
+++ b/examples/config/hibernate/example-hibernate-L2-cache.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~  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.
+  -->
+
+
+<!DOCTYPE hibernate-configuration PUBLIC
+    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<!--
+    Configuration file for HibernateL2CacheExample.
+-->
+
+<hibernate-configuration>
+    <session-factory>
+        <!-- Database connection settings -->
+        <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
+
+        <!-- Drop and re-create the database schema on startup. -->
+        <property name="hbm2ddl.auto">create</property>
+
+        <!-- Enable L2 cache. -->
+        <property name="cache.use_second_level_cache">true</property>
+
+        <!-- Enable query cache. -->
+        <property name="cache.use_query_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 connection release mode. -->
+        <property name="connection.release_mode">on_close</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="org.apache.ignite.examples.datagrid.hibernate.User"/>
+        <mapping class="org.apache.ignite.examples.datagrid.hibernate.Post"/>
+
+        <!-- Per-class L2 cache settings. -->
+        <class-cache class="org.apache.ignite.examples.datagrid.hibernate.User" usage="read-only"/>
+        <class-cache class="org.apache.ignite.examples.datagrid.hibernate.Post" usage="read-only"/>
+        <collection-cache collection="org.apache.ignite.examples.datagrid.hibernate.User.posts" usage="read-only"/>
+    </session-factory>
+</hibernate-configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples/pom-standalone-lgpl.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone-lgpl.xml b/examples/pom-standalone-lgpl.xml
new file mode 100644
index 0000000..7e7ccc2
--- /dev/null
+++ b/examples/pom-standalone-lgpl.xml
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    POM file.
+-->
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+        <!-- will be changed by profile activation. allows to combine profiles. -->
+        <lgpl.folder>src/main/java</lgpl.folder>
+        <java8.folder>src/main/java</java8.folder>
+        <java.ver>1.7</java.ver>
+    </properties>
+
+    <groupId>org.apache.ignite</groupId>
+    <artifactId>ignite-examples</artifactId>
+    <version>to_be_replaced_by_ignite_version</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.cache</groupId>
+            <artifactId>cache-api</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>to_be_replaced_by_ignite_version</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-spring</artifactId>
+            <version>to_be_replaced_by_ignite_version</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-log4j</artifactId>
+            <version>to_be_replaced_by_ignite_version</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-indexing</artifactId>
+            <version>to_be_replaced_by_ignite_version</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.code.simple-spring-memcached</groupId>
+            <artifactId>spymemcached</artifactId>
+            <version>2.7.3</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+    <profiles>
+        <profile>
+            <id>java8</id>
+
+            <properties>
+                <java8.folder>src/main/java8</java8.folder>
+                <java.ver>1.8</java.ver>
+            </properties>
+
+            <activation>
+                <jdk>[1.8,)</jdk>
+            </activation>
+        </profile>
+
+        <profile>
+            <id>scala</id>
+
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.ignite</groupId>
+                    <artifactId>ignite-scalar</artifactId>
+                    <version>to_be_replaced_by_ignite_version</version>
+                </dependency>
+            </dependencies>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>net.alchim31.maven</groupId>
+                        <artifactId>scala-maven-plugin</artifactId>
+                        <version>3.2.0</version>
+                        <configuration>
+                            <jvmArgs>
+                                <jvmArg>-Xms512m</jvmArg>
+                                <jvmArg>-Xmx1024m</jvmArg>
+                            </jvmArgs>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>scala-compile-first</id>
+                                <phase>process-resources</phase>
+                                <goals>
+                                    <goal>add-source</goal>
+                                    <goal>compile</goal>
+                                </goals>
+                            </execution>
+                            <execution>
+                                <id>scala-test-compile</id>
+                                <phase>process-test-resources</phase>
+                                <goals>
+                                    <goal>testCompile</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>lgpl</id>
+
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+
+            <properties>
+                <lgpl.folder>src/main/java-lgpl</lgpl.folder>
+            </properties>
+
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.ignite</groupId>
+                    <artifactId>ignite-hibernate</artifactId>
+                    <version>to_be_replaced_by_ignite_version</version>
+                </dependency>
+
+                <dependency>
+                    <groupId>org.apache.ignite</groupId>
+                    <artifactId>ignite-schedule</artifactId>
+                    <version>to_be_replaced_by_ignite_version</version>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </resource>
+            <resource>
+                <directory>config</directory>
+            </resource>
+        </resources>
+
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <source>${java.ver}</source>
+                    <target>${java.ver}</target>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-sources</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>schema-import/src/main/java</source>
+                                <source>${lgpl.folder}</source>
+                                <source>${java8.folder}</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml
index e314acb..6247ced 100644
--- a/examples/pom-standalone.xml
+++ b/examples/pom-standalone.xml
@@ -28,6 +28,11 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+        <!-- will be changed by profile activation. allows to combine profiles. -->
+        <lgpl.folder>src/main/java</lgpl.folder>
+        <java8.folder>src/main/java</java8.folder>
+        <java.ver>1.7</java.ver>
     </properties>
 
     <groupId>org.apache.ignite</groupId>
@@ -78,84 +83,18 @@
         </dependency>
     </dependencies>
 
-    <build>
-        <resources>
-            <resource>
-                <directory>src/main/java</directory>
-                <excludes>
-                    <exclude>**/*.java</exclude>
-                </excludes>
-            </resource>
-            <resource>
-                <directory>config</directory>
-            </resource>
-        </resources>
-
-        <plugins>
-            <plugin>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.1</version>
-                <configuration>
-                    <source>1.7</source>
-                    <target>1.7</target>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
     <profiles>
         <profile>
-            <id>java8-examples</id>
+            <id>java8</id>
+
+            <properties>
+                <java8.folder>src/main/java8</java8.folder>
+                <java.ver>1.8</java.ver>
+            </properties>
 
             <activation>
                 <jdk>[1.8,)</jdk>
             </activation>
-
-            <build>
-                <plugins>
-                    <plugin>
-                        <artifactId>maven-compiler-plugin</artifactId>
-                        <version>3.1</version>
-                        <configuration>
-                            <source>1.8</source>
-                            <target>1.8</target>
-                        </configuration>
-                    </plugin>
-
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>build-helper-maven-plugin</artifactId>
-                        <version>1.9.1</version>
-                        <executions>
-                            <execution>
-                                <id>add-sources</id>
-                                <phase>generate-sources</phase>
-                                <goals>
-                                    <goal>add-source</goal>
-                                </goals>
-                                <configuration>
-                                    <sources>
-                                        <source>src/main/java8</source>
-                                        <source>schema-import/src/main/java</source>
-                                    </sources>
-                                </configuration>
-                            </execution>
-                            <execution>
-                                <id>add-tests</id>
-                                <phase>generate-test-sources</phase>
-                                <goals>
-                                    <goal>add-test-source</goal>
-                                </goals>
-                                <configuration>
-                                    <sources>
-                                        <source>src/test/java8</source>
-                                    </sources>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
         </profile>
 
         <profile>
@@ -202,5 +141,78 @@
                 </plugins>
             </build>
         </profile>
+
+        <profile>
+            <!-- See README.txt for details -->
+            <id>lgpl</id>
+
+            <activation>
+                <activeByDefault>false</activeByDefault>
+            </activation>
+
+            <properties>
+                <lgpl.folder>src/main/java-lgpl</lgpl.folder>
+            </properties>
+
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.ignite</groupId>
+                    <artifactId>ignite-hibernate</artifactId>
+                    <version>to_be_replaced_by_ignite_version</version>
+                </dependency>
+
+                <dependency>
+                    <groupId>org.apache.ignite</groupId>
+                    <artifactId>ignite-schedule</artifactId>
+                    <version>to_be_replaced_by_ignite_version</version>
+                </dependency>
+            </dependencies>
+        </profile>
     </profiles>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </resource>
+            <resource>
+                <directory>config</directory>
+            </resource>
+        </resources>
+
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <source>${java.ver}</source>
+                    <target>${java.ver}</target>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-sources</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>schema-import/src/main/java</source>
+                                <source>${lgpl.folder}</source>
+                                <source>${java8.folder}</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 34ba05a..5129e7f 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -17,7 +17,8 @@
   limitations under the License.
 -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
@@ -62,6 +63,18 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-hibernate</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-schedule</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>com.google.code.simple-spring-memcached</groupId>
             <artifactId>spymemcached</artifactId>
             <version>2.7.3</version>
@@ -89,41 +102,13 @@
         </dependency>
     </dependencies>
 
-    <build>
-        <resources>
-            <resource>
-                <directory>src/main/java</directory>
-                <excludes>
-                    <exclude>**/*.java</exclude>
-                </excludes>
-            </resource>
-            <resource>
-                <directory>config</directory>
-            </resource>
-        </resources>
-
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <version>1.9.1</version>
-                <executions>
-                    <execution>
-                        <id>add-sources</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>add-source</goal>
-                        </goals>
-                        <configuration>
-                            <sources>
-                                <source>schema-import/src/main/java</source>
-                            </sources>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
+    <properties>
+        <!-- will be changed by profile activation. allows to combine profiles. -->
+        <lgpl.folder>src/main/java</lgpl.folder>
+        <java8.folder>src/main/java</java8.folder>
+        <lgpl.test.folder>src/test/java</lgpl.test.folder>
+        <java8.test.folder>src/test/java</java8.test.folder>
+    </properties>
 
     <profiles>
         <profile>
@@ -195,7 +180,12 @@
         </profile>
 
         <profile>
-            <id>java8-examples</id>
+            <id>java8</id>
+
+            <properties>
+                <java8.folder>src/main/java8</java8.folder>
+                <java8.test.folder>src/test/java8</java8.test.folder>
+            </properties>
 
             <activation>
                 <jdk>[1.8,)</jdk>
@@ -210,41 +200,68 @@
                             <target>1.8</target>
                         </configuration>
                     </plugin>
-
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>build-helper-maven-plugin</artifactId>
-                        <version>1.9.1</version>
-                        <executions>
-                            <execution>
-                                <id>add-sources</id>
-                                <phase>generate-sources</phase>
-                                <goals>
-                                    <goal>add-source</goal>
-                                </goals>
-                                <configuration>
-                                    <sources>
-                                        <source>src/main/java8</source>
-                                        <source>schema-import/src/main/java</source>
-                                    </sources>
-                                </configuration>
-                            </execution>
-                            <execution>
-                                <id>add-tests</id>
-                                <phase>generate-test-sources</phase>
-                                <goals>
-                                    <goal>add-test-source</goal>
-                                </goals>
-                                <configuration>
-                                    <sources>
-                                        <source>src/test/java8</source>
-                                    </sources>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
                 </plugins>
             </build>
         </profile>
+
+        <profile>
+            <id>lgpl</id>
+
+            <properties>
+                <lgpl.folder>src/main/java-lgpl</lgpl.folder>
+                <lgpl.test.folder>src/test/java-lgpl</lgpl.test.folder>
+            </properties>
+        </profile>
     </profiles>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </resource>
+            <resource>
+                <directory>config</directory>
+            </resource>
+        </resources>
+
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-sources</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>schema-import/src/main/java</source>
+                                <source>${lgpl.folder}</source>
+                                <source>${java8.folder}</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>add-tests</id>
+                        <phase>generate-test-sources</phase>
+                        <goals>
+                            <goal>add-test-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${lgpl.test.folder}</source>
+                                <source>${java8.test.folder}</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
new file mode 100644
index 0000000..2f271c8
--- /dev/null
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
@@ -0,0 +1,245 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.examples.datagrid.hibernate;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.service.ServiceRegistryBuilder;
+import org.hibernate.stat.SecondLevelCacheStatistics;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * This example demonstrates the use of Ignite In-Memory Data Ignite cluster as a Hibernate
+ * Second-Level cache provider.
+ * <p>
+ * The Hibernate Second-Level cache (or "L2 cache" shortly) lets you significantly
+ * reduce the number of requests to the underlying SQL database. Because database
+ * access is known to be an expansive operation, using L2 cache may improve
+ * performance dramatically.
+ * <p>
+ * This example defines 2 entity classes: {@link User} and {@link Post}, with
+ * 1 <-> N relation, and marks them with appropriate annotations for Hibernate
+ * object-relational mapping to SQL tables of an underlying H2 in-memory database.
+ * The example launches node in the same JVM and registers it in
+ * Hibernate configuration as an L2 cache implementation. It then stores and
+ * queries instances of the entity classes to and from the database, having
+ * Hibernate SQL output, L2 cache statistics output, and Ignite cache metrics
+ * output enabled.
+ * <p>
+ * When running example, it's easy to notice that when an object is first
+ * put into a database, the L2 cache is not used and it's contents is empty.
+ * However, when an object is first read from the database, it is immediately
+ * stored in L2 cache (which is Ignite In-Memory Data Ignite cluster in fact), which can
+ * be seen in stats output. Further requests of the same object only read the data
+ * from L2 cache and do not hit the database.
+ * <p>
+ * In this example, the Hibernate query cache is also enabled. Query cache lets you
+ * avoid hitting the database in case of repetitive queries with the same parameter
+ * values. You may notice that when the example runs the same query repeatedly in
+ * loop, only the first query hits the database and the successive requests take the
+ * data from L2 cache.
+ * <p>
+ * Note: this example uses {@link AccessType#READ_ONLY} L2 cache access type, but you
+ * can experiment with other access types by modifying the Hibernate configuration file
+ * {@code IGNITE_HOME/examples/config/hibernate/example-hibernate-L2-cache.xml}, used by the example.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class HibernateL2CacheExample {
+    /** JDBC URL for backing database (an H2 in-memory database is used). */
+    private static final String JDBC_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
+
+    /** Path to hibernate configuration file (will be resolved from application {@code CLASSPATH}). */
+    private static final String HIBERNATE_CFG = "hibernate/example-hibernate-L2-cache.xml";
+
+    /** Entity names for stats output. */
+    private static final List<String> ENTITY_NAMES =
+        Arrays.asList(User.class.getName(), Post.class.getName(), User.class.getName() + ".posts");
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        // Start the node, run the example, and stop the node when finished.
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            // We use a single session factory, but create a dedicated session
+            // for each transaction or query. This way we ensure that L1 cache
+            // is not used (L1 cache has per-session scope only).
+            System.out.println();
+            System.out.println(">>> Hibernate L2 cache example started.");
+
+            try (
+                // Create all required caches.
+                IgniteCache c1 = createCache("org.hibernate.cache.spi.UpdateTimestampsCache", ATOMIC);
+                IgniteCache c2 = createCache("org.hibernate.cache.internal.StandardQueryCache", ATOMIC);
+                IgniteCache c3 = createCache("org.apache.ignite.examples.datagrid.hibernate.User", TRANSACTIONAL);
+                IgniteCache c4 = createCache("org.apache.ignite.examples.datagrid.hibernate.User.posts", TRANSACTIONAL);
+                IgniteCache c5 = createCache("org.apache.ignite.examples.datagrid.hibernate.Post", TRANSACTIONAL)
+            ) {
+                URL hibernateCfg = ExamplesUtils.url(HIBERNATE_CFG);
+
+                SessionFactory sesFactory = createHibernateSessionFactory(hibernateCfg);
+
+                System.out.println();
+                System.out.println(">>> Creating objects.");
+
+                final long userId;
+
+                Session ses = sesFactory.openSession();
+
+                try {
+                    Transaction tx = ses.beginTransaction();
+
+                    User user = new User("jedi", "Luke", "Skywalker");
+
+                    user.getPosts().add(new Post(user, "Let the Force be with you."));
+
+                    ses.save(user);
+
+                    tx.commit();
+
+                    // Create a user object, store it in DB, and save the database-generated
+                    // object ID. You may try adding more objects in a similar way.
+                    userId = user.getId();
+                }
+                finally {
+                    ses.close();
+                }
+
+                // Output L2 cache and Ignite cache stats. You may notice that
+                // at this point the object is not yet stored in L2 cache, because
+                // the read was not yet performed.
+                printStats(sesFactory);
+
+                System.out.println();
+                System.out.println(">>> Querying object by ID.");
+
+                // Query user by ID several times. First time we get an L2 cache
+                // miss, and the data is queried from DB, but it is then stored
+                // in cache and successive queries hit the cache and return
+                // immediately, no SQL query is made.
+                for (int i = 0; i < 3; i++) {
+                    ses = sesFactory.openSession();
+
+                    try {
+                        Transaction tx = ses.beginTransaction();
+
+                        User user = (User)ses.get(User.class, userId);
+
+                        System.out.println("User: " + user);
+
+                        for (Post post : user.getPosts())
+                            System.out.println("\tPost: " + post);
+
+                        tx.commit();
+                    }
+                    finally {
+                        ses.close();
+                    }
+                }
+
+                // Output the stats. We should see 1 miss and 2 hits for
+                // User and Collection object (stored separately in L2 cache).
+                // The Post is loaded with the collection, so it won't imply
+                // a miss.
+                printStats(sesFactory);
+            }
+        }
+    }
+
+    /**
+     * Creates cache.
+     *
+     * @param name Cache name.
+     * @param atomicityMode Atomicity mode.
+     * @return Cache configuration.
+     */
+    private static IgniteCache createCache(String name, CacheAtomicityMode atomicityMode) {
+        CacheConfiguration ccfg = new CacheConfiguration(name);
+
+        ccfg.setAtomicityMode(atomicityMode);
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        return Ignition.ignite().getOrCreateCache(ccfg);
+    }
+
+    /**
+     * Creates a new Hibernate {@link SessionFactory} using a programmatic
+     * configuration.
+     *
+     * @param hibernateCfg Hibernate configuration file.
+     * @return New Hibernate {@link SessionFactory}.
+     */
+    private static SessionFactory createHibernateSessionFactory(URL hibernateCfg) {
+        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+
+        builder.applySetting("hibernate.connection.url", JDBC_URL);
+        builder.applySetting("hibernate.show_sql", true);
+
+        return new Configuration()
+            .configure(hibernateCfg)
+            .buildSessionFactory(builder.buildServiceRegistry());
+    }
+
+    /**
+     * Prints Hibernate L2 cache statistics to standard output.
+     *
+     * @param sesFactory Hibernate {@link SessionFactory}, for which to print
+     *                   statistics.
+     */
+    private static void printStats(SessionFactory sesFactory) {
+        System.out.println("=== Hibernate L2 cache statistics ===");
+
+        for (String entityName : ENTITY_NAMES) {
+            System.out.println("\tEntity: " + entityName);
+
+            SecondLevelCacheStatistics stats =
+                sesFactory.getStatistics().getSecondLevelCacheStatistics(entityName);
+
+            System.out.println("\t\tL2 cache entries: " + stats.getEntries());
+            System.out.println("\t\tHits: " + stats.getHitCount());
+            System.out.println("\t\tMisses: " + stats.getMissCount());
+        }
+
+        System.out.println("=====================================");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd2cd923/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/Post.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/Post.java b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/Post.java
new file mode 100644
index 0000000..8e98835
--- /dev/null
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/Post.java
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.examples.datagrid.hibernate;
+
+import java.util.Date;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+/**
+ * An entity class representing a post, that a
+ * {@link User} has made on some public service.
+ */
+@Entity
+class Post {
+    /** ID. */
+    @Id
+    @GeneratedValue(strategy=GenerationType.AUTO)
+    private long id;
+
+    /** Author. */
+    @ManyToOne
+    private User author;
+
+    /** Text. */
+    private String text;
+
+    /** Created timestamp. */
+    private Date created;
+
+    /**
+     * Default constructor (required by Hibernate).
+     */
+    Post() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param author Author.
+     * @param text Text.
+     */
+    Post(User author, String text) {
+        this.author = author;
+        this.text = text;
+        created = new Date();
+    }
+
+    /**
+     * @return ID.
+     */
+    public long getId() {
+        return id;
+    }
+
+    /**
+     * @param id New ID.
+     */
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    /**
+     * @return Author.
+     */
+    public User getAuthor() {
+        return author;
+    }
+
+    /**
+     * @param author New author.
+     */
+    public void setAuthor(User author) {
+        this.author = author;
+    }
+
+    /**
+     * @return Text.
+     */
+    public String getText() {
+        return text;
+    }
+
+    /**
+     * @param text New text.
+     */
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    /**
+     * @return Created timestamp.
+     */
+    public Date getCreated() {
+        return (Date)created.clone();
+    }
+
+    /**
+     * @param created New created timestamp.
+     */
+    public void setCreated(Date created) {
+        this.created = (Date)created.clone();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Post [id=" + id +
+            ", text=" + text +
+            ", created=" + created +
+            ']';
+    }
+}