# IGNITE-329 Review.

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

Branch: refs/heads/ignite-gg-9828
Commit: 660597310899cd45a1f21b5d4c82652d81cccb00
Parents: 91bca56
Author: AKuznetsov <akuznet...@gridgain.com>
Authored: Tue Mar 10 21:31:06 2015 +0700
Committer: AKuznetsov <akuznet...@gridgain.com>
Committed: Tue Mar 10 21:31:06 2015 +0700

----------------------------------------------------------------------
 modules/schema-import/readme.txt | 55 +++++++++++++++++++++++------------
 1 file changed, 37 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/66059731/modules/schema-import/readme.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/readme.txt b/modules/schema-import/readme.txt
index 7a16bd4..b0f6653 100644
--- a/modules/schema-import/readme.txt
+++ b/modules/schema-import/readme.txt
@@ -1,34 +1,44 @@
 Apache Ignite Schema Import Module
 ------------------------------
 
-Apache Ignite Schema Import module provides a simple utility that 
automatically reads the database schema,
-creates required type mapping description, and optionally generates the domain 
model in Java.
+Ignite ships with its own database schema mapping wizard which provides 
automatic support for integrating with
+persistence stores. This utility automatically connects to the underlying 
database and generates all the required
+XML OR-mapping configuration and Java domain model POJOs.
 
-For running utility use 'ignite-schema-import.{sh|bat}' script. For connection 
with RDBMS system from utility
-you need to provide: connection url and jdbc driver.
+To start the wizard for generating database schema mapping, execute 
bin/ignite-schema-load.sh script:
 
+For connection with RDBMS system from utility you need to provide: connection 
url and jdbc driver.
+Note that JDBC drivers are not supplied with the utility and should be 
provided separately.
 
 Moving from disk-based architectures to in-memory architectures
 ------------------------------------------
 
 Use Schema Import Utility for generation of type mapping and domain model in 
Java.
 
-For example you may use the following script for create sample type in your 
RDBMS system:
+For example you may use the following script for create sample type 'Person' 
in your RDBMS system:
 
-create table PERSONS(id integer not null, firstName varchar(50), lastName 
varchar(50), PRIMARY KEY(id));
+create table PERSON(id integer not null, firstName varchar(50), lastName 
varchar(50), PRIMARY KEY(id));
 
-insert into PERSONS(id, first_name, last_name) values(1, 'Johannes', 'Kepler');
-insert into PERSONS(id, first_name, last_name) values(2, 'Galileo', 'Galilei');
-insert into PERSONS(id, first_name, last_name) values(3, 'Henry', 'More');
-insert into PERSONS(id, first_name, last_name) values(4, 'Polish', 'Brethren');
-insert into PERSONS(id, first_name, last_name) values(5, 'Robert', 'Boyle');
-insert into PERSONS(id, first_name, last_name) values(6, 'Isaac', 'Newton');
+insert into PERSON(id, first_name, last_name) values(1, 'Johannes', 'Kepler');
+insert into PERSON(id, first_name, last_name) values(2, 'Galileo', 'Galilei');
+insert into PERSON(id, first_name, last_name) values(3, 'Henry', 'More');
+insert into PERSON(id, first_name, last_name) values(4, 'Polish', 'Brethren');
+insert into PERSON(id, first_name, last_name) values(5, 'Robert', 'Boyle');
+insert into PERSON(id, first_name, last_name) values(6, 'Isaac', 'Newton');
 
-You need place compiled domain model classes, jdbc driver (used for connect to 
you RDBMS system) in Ignite node classpath,
-for example place in 'libs' folder.
+The Ignite Schema Import utility generates the following artifacts:
+ # Java POJO key and value classes
+ # XML CacheTypeMetadata configuration
+ # Java configuration snippet (alternative to XML)
 
-Append type mapping description generated by Schema Import Utility to your 
cache configuration and setup DataSource
-to your RDBMS system for cache store.
+After you exit from the wizard, you should:
+ # Copy generated POJO java classes to you project source folder.
+ # Copy XML declaration of CacheTypeMetadata to your Ignite XML configuration 
file under appropriate
+  CacheConfiguration root.
+ # Setup your Ignite XML configuration file DataSource to your RDBMS system 
for CacheJdbcPojoStore.
+ # Or paste Java snippet with cache configuration into your Ignite 
initialization logic.
+ # You need place compiled domain model classes, jdbc driver (used for connect 
to you RDBMS system) in Ignite node
+  classpath, for example place in 'libs' folder.
 
 Example of spring configuration:
 
@@ -133,10 +143,10 @@ ccfg.setWriteThrough(true);
 // Configure cache types.
 Collection<CacheTypeMetadata> meta = new ArrayList<>();
 
-// PERSONS type mapping.
+// PERSON type mapping.
 CacheTypeMetadata tm = new CacheTypeMetadata();
 
-tm.setDatabaseTable("PERSONS");
+tm.setDatabaseTable("PERSON");
 
 tm.setKeyType("java.lang.Long");
 tm.setValueType("org.apache.ignite.examples.datagrid.store.model.Person");
@@ -157,3 +167,12 @@ cfg.setCacheConfiguration(ccfg);
 ...
 // Start Ignite node.
 Ignition.start(cfg);
+
+Now you can load all data from database to cache:
+    IgniteCache<Long, Person> cache = ignite.jcache(CACHE_NAME);
+    cache.loadCache(null);
+
+Or you can load data from database to cache with custom SQL:
+    cache.loadCache(null, "java.lang.Long", "select * from PERSON where id = 
2")
+
+Also if you put data into cache it will be inserted / updated in underlying 
database.

Reply via email to