ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [39/50] [abbrv] incubator-ignite git commit: # ignite-45 - demo fixes.
Date Tue, 24 Mar 2015 10:16:43 GMT
# ignite-45 - demo fixes.


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

Branch: refs/heads/ignite-497-stick
Commit: b585c6276b1fdc013123058e116460be1534c8e5
Parents: 78800c3
Author: Dmitiry Setrakyan <dsetrakyan@gridgain.com>
Authored: Tue Mar 24 00:40:34 2015 -0700
Committer: Dmitiry Setrakyan <dsetrakyan@gridgain.com>
Committed: Tue Mar 24 00:40:34 2015 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/schema/Demo.java      | 10 ++++++++++
 .../src/main/java/org/apache/ignite/schema/PersonKey.java |  7 +++++++
 2 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b585c627/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
----------------------------------------------------------------------
diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
index 139ae2f..6c15141 100644
--- a/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
+++ b/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
@@ -105,6 +105,9 @@ public class Demo {
     private static void readThrough(IgniteCache<PersonKey, Person> cache) {
         PersonKey key = new PersonKey(4);
 
+        System.out.println();
+        System.out.println(">>> Read-through person from database for ID: " + key.getId());
+
         // Check that person with ID=4 is not in cache.
         Person p = cache.localPeek(key);
 
@@ -122,10 +125,15 @@ public class Demo {
     private static void transaction(Ignite ignite, IgniteCache<PersonKey, Person> cache)
{
         PersonKey key = new PersonKey(5);
 
+        System.out.println();
+        System.out.println(">>> Update salary and write-through to database for
person with ID: " + key.getId());
+
         try (Transaction tx = ignite.transactions().txStart()) {
             // Read-through from database.
             Person p = cache.get(key);
 
+            System.out.println(">>> Loaded person from database: " + p);
+
             double salary = p.getSalary();
 
             // Raise salary by 20%.
@@ -137,5 +145,7 @@ public class Demo {
 
             tx.commit();
         }
+
+        System.out.println(">>> Updated person: " + cache.get(key));
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b585c627/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java
----------------------------------------------------------------------
diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java
b/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java
index 919b96b..4898c5e 100644
--- a/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java
+++ b/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java
@@ -27,5 +27,12 @@ public class PersonKey {
     public PersonKey(int id) {
         throw new IllegalStateException("PersonKey should be generated by Ignite Schema Import
Utility");
     }
+
+    /**
+     * @return Person ID.
+     */
+    public int getId() {
+        throw new IllegalStateException("PersonKey should be generated by Ignite Schema Import
Utility");
+    }
 }
 


Mime
View raw message