Skip to content

Commit

Permalink
add more tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
kmetin committed Sep 26, 2023
1 parent 14ab55c commit 68d7cbe
Showing 1 changed file with 45 additions and 3 deletions.
48 changes: 45 additions & 3 deletions docs/modules/ROOT/pages/using-compact-serializer-generator.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,50 @@ ClientConfig clientConfig = new ClientConfig();
new com.education.School.Serializer());
----

== Creating Mapping
== SQL Support

== Writing to a Map using Java Client
=== Creating Mapping

== Querying the Map using Python Client
If map's keys or values have `Compact` format, you need to provide the following additional options while creating the mapping:

* `keyCompactTypeName`
* `valueCompactTypeName`

[source,sql]
----
CREATE OR REPLACE MAPPING students(
id INT EXTERNAL NAME "__key.id",
name VARCHAR
) TYPE IMap
OPTIONS (
'keyFormat' = 'compact',
'keyCompactTypeName' = 'studentId',
'valueFormat' = 'compact',
'valueCompactTypeName' = 'student'
);
----

=== Writing to a Map using Java Client

[source,java]
----
IMap<Integer, Student> studentsMap = client.getMap("students");
Student s = new Student(4, "Student4");
studentsMap.put(4, s);
----

=== Querying the Map using Java Client

[source, java]
----
SqlResult result = sqlService.execute("SELECT this FROM students")
for (SqlRow row : result) {
Student s = row.getObject("this");
System.out.println(s.getId())
System.out.println(s.getName())
}
----

== Schema Evolution

== Generic Record Representation

0 comments on commit 68d7cbe

Please sign in to comment.