ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [01/37] incubator-ignite git commit: # IGNITE-329 Example of CacheTypeMetadata and CacheJdbcPojoStore usage.
Date Thu, 12 Mar 2015 12:55:41 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-406 436154333 -> 94ed54125


# IGNITE-329 Example of  CacheTypeMetadata and CacheJdbcPojoStore usage.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f9038471
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f9038471
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f9038471

Branch: refs/heads/ignite-406
Commit: f9038471553d5b32d76443acc1c9104d85016e5a
Parents: e86c69e
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Tue Feb 24 15:15:27 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Tue Feb 24 15:15:27 2015 +0700

----------------------------------------------------------------------
 .../config/store/example-jdbc-pojo-store.xml    | 183 +++++++++++++++++++
 .../datagrid/CacheJdbcPojoStoreExample.java     | 167 +++++++++++++++++
 .../datagrid/store/model/Organization.java      | 155 ++++++++++++++++
 .../datagrid/store/model/OrganizationKey.java   |  97 ++++++++++
 .../examples/datagrid/store/model/Person.java   | 155 ++++++++++++++++
 .../datagrid/store/model/PersonKey.java         |  97 ++++++++++
 6 files changed, 854 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9038471/examples/config/store/example-jdbc-pojo-store.xml
----------------------------------------------------------------------
diff --git a/examples/config/store/example-jdbc-pojo-store.xml b/examples/config/store/example-jdbc-pojo-store.xml
new file mode 100644
index 0000000..608d9c1
--- /dev/null
+++ b/examples/config/store/example-jdbc-pojo-store.xml
@@ -0,0 +1,183 @@
+<?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.
+  -->
+
+<!--
+    Ignite Spring configuration file to startup Ignite cache.
+
+    When starting a standalone node, you need to execute the following command:
+    {IGNITE_HOME}/bin/ignite.{bat|sh} examples/config/example-jdbc-pojo-store.xml
+
+    When starting Ignite from Java IDE, pass path to this file to Ignition:
+    Ignition.start("examples/config/example-jdbc-pojo-store.xml");
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+    <bean id="jdbcPojoStore" class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore">
+        <property name="dialect">
+            <bean class="org.apache.ignite.cache.store.jdbc.dialect.H2Dialect"/>
+        </property>
+
+        <property name="dataSource">
+            <bean class="org.h2.jdbcx.JdbcConnectionPool" factory-method="create">
+                <constructor-arg value="jdbc:h2:tcp://localhost/mem:ExampleDb"/>
+                <constructor-arg value="sa"/>
+                <constructor-arg value=""/>
+            </bean>
+        </property>
+    </bean>
+
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <!-- Set to true to enable distributed class loading for examples, default is
false. -->
+        <property name="peerClassLoadingEnabled" value="true"/>
+
+        <property name="marshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
+                <!-- Set to false to allow non-serializable objects in examples, default
is true. -->
+                <property name="requireSerializable" value="false"/>
+            </bean>
+        </property>
+
+        <!-- Cache configuration. -->
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="partitioned"/>
+                    <property name="cacheMode" value="PARTITIONED"/>
+                    <property name="atomicityMode" value="ATOMIC"/>
+                    <property name="distributionMode" value="PARTITIONED_ONLY"/>
+                    <property name="preloadMode" value="SYNC"/>
+                    <property name="backups" value="1"/>
+
+                    <property name="cacheStoreFactory">
+                        <bean class="javax.cache.configuration.FactoryBuilder$SingletonFactory">
+                            <constructor-arg ref="jdbcPojoStore"/>
+                        </bean>
+                    </property>
+
+                    <property name="typeMetadata">
+                        <list>
+                            <bean class="org.apache.ignite.cache.CacheTypeMetadata">
+                                <property name="databaseSchema" value="PUBLIC"/>
+                                <property name="databaseTable" value="ORGANIZATION"/>
+                                <property name="keyType" value="org.apache.ignite.examples.datagrid.store.model.OrganizationKey"/>
+                                <property name="valueType" value="org.apache.ignite.examples.datagrid.store.model.Organization"/>
+                                <property name="keyFields">
+                                    <list>
+                                        <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                            <property name="databaseName" value="ID"/>
+                                            <property name="databaseType" value="4"/>
+                                            <property name="javaName" value="id"/>
+                                            <property name="javaType" value="int"/>
+                                        </bean>
+                                    </list>
+                                </property>
+                                <property name="valueFields">
+                                    <list>
+                                        <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                            <property name="databaseName" value="ID"/>
+                                            <property name="databaseType" value="4"/>
+                                            <property name="javaName" value="id"/>
+                                            <property name="javaType" value="int"/>
+                                        </bean>
+                                        <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                            <property name="databaseName" value="NAME"/>
+                                            <property name="databaseType" value="12"/>
+                                            <property name="javaName" value="name"/>
+                                            <property name="javaType" value="java.lang.String"/>
+                                        </bean>
+                                        <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                            <property name="databaseName" value="CITY"/>
+                                            <property name="databaseType" value="12"/>
+                                            <property name="javaName" value="city"/>
+                                            <property name="javaType" value="java.lang.String"/>
+                                        </bean>
+                                    </list>
+                                </property>
+                            </bean>
+                            <bean class="org.apache.ignite.cache.CacheTypeMetadata">
+                                <property name="databaseSchema" value="PUBLIC"/>
+                                <property name="databaseTable" value="PERSON"/>
+                                <property name="keyType" value="org.apache.ignite.examples.datagrid.store.model.PersonKey"/>
+                                <property name="valueType" value="org.apache.ignite.examples.datagrid.store.model.Person"/>
+                                <property name="keyFields">
+                                    <list>
+                                        <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                            <property name="databaseName" value="ID"/>
+                                            <property name="databaseType" value="4"/>
+                                            <property name="javaName" value="id"/>
+                                            <property name="javaType" value="int"/>
+                                        </bean>
+                                    </list>
+                                </property>
+                                <property name="valueFields">
+                                    <list>
+                                        <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                            <property name="databaseName" value="ID"/>
+                                            <property name="databaseType" value="4"/>
+                                            <property name="javaName" value="id"/>
+                                            <property name="javaType" value="int"/>
+                                        </bean>
+                                        <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                            <property name="databaseName" value="ORG_ID"/>
+                                            <property name="databaseType" value="4"/>
+                                            <property name="javaName" value="orgId"/>
+                                            <property name="javaType" value="java.lang.Integer"/>
+                                        </bean>
+                                        <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                            <property name="databaseName" value="NAME"/>
+                                            <property name="databaseType" value="12"/>
+                                            <property name="javaName" value="name"/>
+                                            <property name="javaType" value="java.lang.String"/>
+                                        </bean>
+                                    </list>
+                                </property>
+                            </bean>
+                        </list>
+                    </property>
+                </bean>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes.
-->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <!--
+                        Ignite provides several options for automatic discovery that can
be used
+                        instead os static IP based discovery. For information on all options
refer
+                        to our documentation: http://doc.gridgain.org/latest/Automatic+Node+Discovery
+                    -->
+                    <!-- Uncomment static IP finder to enable static-based discovery of
initial nodes. -->
+                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <!-- In distributed environment, replace with actual host
IP address. -->
+                                <value>127.0.0.1:47500..47501</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9038471/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheJdbcPojoStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheJdbcPojoStoreExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheJdbcPojoStoreExample.java
new file mode 100644
index 0000000..f76afc8
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheJdbcPojoStoreExample.java
@@ -0,0 +1,167 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.examples.datagrid.store.model.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.h2.tools.*;
+
+import java.sql.*;
+import java.util.*;
+
+/**
+ * This examples demonstrates loading data into cache from underlying JDBC store.
+ */
+public class CacheJdbcPojoStoreExample {
+    /** DB connection URL. */
+    private static final String CONN_URL = "jdbc:h2:mem:ExampleDb;DB_CLOSE_DELAY=-1";
+
+    /** Cache name. */
+    private static final String CACHE_NAME = "partitioned";
+
+    /** Number of generated organizations. */
+    private static final int ORGANIZATION_CNT = 5;
+
+    /** Number of generated persons. */
+    private static final int PERSON_CNT = 100;
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws Exception If example execution failed.
+     */
+    public static void main(String[] args) throws Exception {
+        System.out.println("Populate database with sample data.");
+
+        createDb();
+
+        // Start H2 database TCP server in order to access sample in-memory database from
other processes.
+        // This is H2 specific only.
+        Server srv = Server.createTcpServer().start();
+
+        // Start node and load cache from database.
+        try (Ignite ignite = Ignition.start("examples/config/store/example-jdbc-pojo-store.xml"))
{
+            IgniteCache<Object, Object> cache = ignite.jcache(CACHE_NAME);
+
+            System.out.println("Load whole DB into cache.");
+
+            cache.loadCache(null);
+
+            System.out.println("Print loaded content.");
+
+            System.out.println("Organizations:");
+            for (int i = 0; i < ORGANIZATION_CNT; i++) {
+                OrganizationKey orgKey = new OrganizationKey(i);
+
+                System.out.println("    " + cache.get(orgKey));
+            }
+
+            System.out.println("Persons:");
+            for (int i = 0; i < PERSON_CNT; i++) {
+                PersonKey prnKey = new PersonKey(i);
+
+                System.out.println("    " + cache.get(prnKey));
+            }
+
+            System.out.println("Clear cache for next demo.");
+
+            cache.clear();
+
+            System.out.println("Cache size = " + cache.size());
+
+            System.out.println("Load cache by custom SQL.");
+
+            // JDBC cache store accept pairs of "full key class name -> SQL statement"
+            cache.loadCache(null,
+                "org.apache.ignite.examples.datagrid.store.model.OrganizationKey",
+                "SELECT * FROM Organization WHERE id = 2",
+                "org.apache.ignite.examples.datagrid.store.model.PersonKey",
+                "SELECT * FROM Person WHERE id = 5");
+
+            System.out.println("Check custom SQL.");
+            System.out.println("    Organization: " + cache.get(new OrganizationKey(2)));
+            System.out.println("    Person: " + cache.get(new PersonKey(5)));
+        }
+
+        // Stop H2 TCP server. H2 specific only.
+        srv.stop();
+
+        System.exit(0);
+    }
+
+    /**
+     * Create example DB and populate it with sample data.
+     *
+     * @throws Exception If failed to create databse and populate it with sample data.
+     */
+    private static void createDb() throws Exception {
+        Class.forName("org.h2.Driver");
+
+        Connection conn = DriverManager.getConnection(CONN_URL, "sa", "");
+
+        Statement stmt = conn.createStatement();
+
+        stmt.executeUpdate("CREATE TABLE IF NOT EXISTS Organization" +
+            "(id integer not null, name varchar(50), city varchar(50), PRIMARY KEY(id))");
+
+        stmt.executeUpdate("CREATE TABLE IF NOT EXISTS Person" +
+            "(id integer not null, org_id integer, name varchar(50), PRIMARY KEY(id))");
+
+        U.closeQuiet(stmt);
+
+        conn.commit();
+
+        PreparedStatement orgStmt = conn.prepareStatement("INSERT INTO Organization(id, name,
city) VALUES (?, ?, ?)");
+
+        for (int i = 0; i < ORGANIZATION_CNT; i++) {
+            orgStmt.setInt(1, i);
+            orgStmt.setString(2, "org-name-" + i);
+            orgStmt.setString(3, "city-" + i);
+
+            orgStmt.addBatch();
+        }
+
+        orgStmt.executeBatch();
+
+        U.closeQuiet(orgStmt);
+
+        conn.commit();
+
+        PreparedStatement prnStmt = conn.prepareStatement("INSERT INTO Person(id, org_id,
name) VALUES (?, ?, ?)");
+
+        Random rnd = new Random();
+
+        for (int i = 0; i < PERSON_CNT; i++) {
+            prnStmt.setInt(1, i);
+            prnStmt.setInt(2, rnd.nextInt(ORGANIZATION_CNT));
+            prnStmt.setString(3, "person-name-" + i);
+
+            prnStmt.addBatch();
+        }
+
+        prnStmt.executeBatch();
+
+        U.closeQuiet(prnStmt);
+
+        conn.commit();
+
+        U.closeQuiet(conn);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9038471/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Organization.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Organization.java
new file mode 100644
index 0000000..98e62eb
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Organization.java
@@ -0,0 +1,155 @@
+/*
+ * 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.store.model;
+
+import java.io.*;
+
+/**
+ * Organization definition.
+ *
+ * Code generated by Apache Ignite Schema Load utility: 02/24/2015.
+ */
+public class Organization implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Value for id. */
+    private int id;
+
+    /** Value for name. */
+    private String name;
+
+    /** Value for city. */
+    private String city;
+
+    /**
+     * Empty constructor.
+     */
+    public Organization() {
+        // No-op.
+    }
+
+    /**
+     * Full constructor.
+     */
+    public Organization(
+        int id,
+        String name,
+        String city
+    ) {
+        this.id = id;
+        this.name = name;
+        this.city = city;
+    }
+
+    /**
+     * Gets id.
+     *
+     * @return Value for id.
+     */
+    public int getId() {
+        return id;
+    }
+
+    /**
+     * Sets id.
+     *
+     * @param id New value for id.
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    /**
+     * Gets name.
+     *
+     * @return Value for name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets name.
+     *
+     * @param name New value for name.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Gets city.
+     *
+     * @return Value for city.
+     */
+    public String getCity() {
+        return city;
+    }
+
+    /**
+     * Sets city.
+     *
+     * @param city New value for city.
+     */
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (!(o instanceof Organization))
+            return false;
+
+        Organization that = (Organization)o;
+
+        if (id != that.id)
+            return false;
+
+        if (name != null ? !name.equals(that.name) : that.name != null)
+            return false;
+
+        if (city != null ? !city.equals(that.city) : that.city != null)
+            return false;
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = id;
+
+        res = 31 * res + (name != null ? name.hashCode() : 0);
+
+        res = 31 * res + (city != null ? city.hashCode() : 0);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Organization [id=" + id +
+            ", name=" + name +
+            ", city=" + city +
+            "]";
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9038471/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/OrganizationKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/OrganizationKey.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/OrganizationKey.java
new file mode 100644
index 0000000..f142754
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/OrganizationKey.java
@@ -0,0 +1,97 @@
+/*
+ * 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.store.model;
+
+import java.io.*;
+
+/**
+ * OrganizationKey definition.
+ *
+ * Code generated by Apache Ignite Schema Load utility: 02/24/2015.
+ */
+public class OrganizationKey implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Value for id. */
+    private int id;
+
+    /**
+     * Empty constructor.
+     */
+    public OrganizationKey() {
+        // No-op.
+    }
+
+    /**
+     * Full constructor.
+     */
+    public OrganizationKey(
+        int id
+    ) {
+        this.id = id;
+    }
+
+    /**
+     * Gets id.
+     *
+     * @return Value for id.
+     */
+    public int getId() {
+        return id;
+    }
+
+    /**
+     * Sets id.
+     *
+     * @param id New value for id.
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (!(o instanceof OrganizationKey))
+            return false;
+
+        OrganizationKey that = (OrganizationKey)o;
+
+        if (id != that.id)
+            return false;
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = id;
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "OrganizationKey [id=" + id +
+            "]";
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9038471/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Person.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Person.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Person.java
new file mode 100644
index 0000000..ad56534
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Person.java
@@ -0,0 +1,155 @@
+/*
+ * 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.store.model;
+
+import java.io.*;
+
+/**
+ * Person definition.
+ *
+ * Code generated by Apache Ignite Schema Load utility: 02/24/2015.
+ */
+public class Person implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Value for id. */
+    private int id;
+
+    /** Value for orgId. */
+    private Integer orgId;
+
+    /** Value for name. */
+    private String name;
+
+    /**
+     * Empty constructor.
+     */
+    public Person() {
+        // No-op.
+    }
+
+    /**
+     * Full constructor.
+     */
+    public Person(
+        int id,
+        Integer orgId,
+        String name
+    ) {
+        this.id = id;
+        this.orgId = orgId;
+        this.name = name;
+    }
+
+    /**
+     * Gets id.
+     *
+     * @return Value for id.
+     */
+    public int getId() {
+        return id;
+    }
+
+    /**
+     * Sets id.
+     *
+     * @param id New value for id.
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    /**
+     * Gets orgId.
+     *
+     * @return Value for orgId.
+     */
+    public Integer getOrgId() {
+        return orgId;
+    }
+
+    /**
+     * Sets orgId.
+     *
+     * @param orgId New value for orgId.
+     */
+    public void setOrgId(Integer orgId) {
+        this.orgId = orgId;
+    }
+
+    /**
+     * Gets name.
+     *
+     * @return Value for name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets name.
+     *
+     * @param name New value for name.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (!(o instanceof Person))
+            return false;
+
+        Person that = (Person)o;
+
+        if (id != that.id)
+            return false;
+
+        if (orgId != null ? !orgId.equals(that.orgId) : that.orgId != null)
+            return false;
+
+        if (name != null ? !name.equals(that.name) : that.name != null)
+            return false;
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = id;
+
+        res = 31 * res + (orgId != null ? orgId.hashCode() : 0);
+
+        res = 31 * res + (name != null ? name.hashCode() : 0);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Person [id=" + id +
+            ", orgId=" + orgId +
+            ", name=" + name +
+            "]";
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9038471/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/PersonKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/PersonKey.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/PersonKey.java
new file mode 100644
index 0000000..ec517d5
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/PersonKey.java
@@ -0,0 +1,97 @@
+/*
+ * 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.store.model;
+
+import java.io.*;
+
+/**
+ * PersonKey definition.
+ *
+ * Code generated by Apache Ignite Schema Load utility: 02/24/2015.
+ */
+public class PersonKey implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Value for id. */
+    private int id;
+
+    /**
+     * Empty constructor.
+     */
+    public PersonKey() {
+        // No-op.
+    }
+
+    /**
+     * Full constructor.
+     */
+    public PersonKey(
+        int id
+    ) {
+        this.id = id;
+    }
+
+    /**
+     * Gets id.
+     *
+     * @return Value for id.
+     */
+    public int getId() {
+        return id;
+    }
+
+    /**
+     * Sets id.
+     *
+     * @param id New value for id.
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (!(o instanceof PersonKey))
+            return false;
+
+        PersonKey that = (PersonKey)o;
+
+        if (id != that.id)
+            return false;
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = id;
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "PersonKey [id=" + id +
+            "]";
+    }
+}
+


Mime
View raw message