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 = "SELECTtest.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_idFROM test";sql.execute(sql);
Hiç yorum yok:
Yorum Gönder