12 Ocak 2023 Perşembe

Hazelcast SQL - CREATE TYPE Örnekleri

Örnek
Kodla şöyle yaparız
HazelcastInstance hz = ...;
SqlService sql = hz.getSql();

sql.execute("CREATE TYPE UserType (id BIGINT, name VARCHAR, organization OrganizationType)
  OPTIONS ('format'='java', 'javaClass'='com.foo.User')");

sql.execute("CREATE TYPE OrganizationType (id BIGINT, name VARCHAR, office OfficeType) "
OPTIONS ('format'='java', 'javaClass'='com.foo.Organization')");
sql.execute("CREATE TYPE OfficeType (id BIGINT, name VARCHAR) "
OPTIONS ('format'='java', 'javaClass'='com.foo.Office')");

IMap<Long, User> testMap = testInstance().getMap("test");
sql.execute("CREATE MAPPING test (__key BIGINT, this UserType) "
TYPE IMap OPTIONS (
'keyFormat'='bigint',
'valueFormat'='java',
  'valueJavaClass'='com.foo.User'");

String sql = "SELECT
test.this.name AS user_name, "
  test.this.organization.name AS org_name,
  test.this.organization.office.name AS office_name,
  test.this.organization.office.id AS office_id
FROM test";

sql.execute(sql);

Hiç yorum yok:

Yorum Gönder

THIRD-PARTY.txt Dosyası

Kullanılan harici kütüphanelerin sürümleri bu dosyada Dosyanın yolu şöyle hazelcast/licenses/THIRD-PARTY.txt