Hi,
I made a quick test to create a City table through DBeaver, and then I
accessed it through java app successfully.

But, when I loop the record, I found both of key and value were built by
BinaryObject with strange type.
Question 1: 
Is there any convenient API to get the type name from cache level?  
sth like this:
cache.getMetrics.getBinaryTypeName().
I'm just curious if JDBC operations could interact with JAVA api

Question 2: 
In JDBC is there any command like 'describe tablename' to query cache
structure?


    public static void GetAll(IgniteCache<BinaryObject, BinaryObject> cache)
{
        Iterator<Cache.Entry&lt;BinaryObject, BinaryObject>>  itr =
cache.iterator();
        while(itr.hasNext()){
                Cache.Entry<BinaryObject, BinaryObject> item = itr.next();
                System.out.println("id="+item.getKey().field("id")+" 
KeyType="+item.getKey().type().typeName().toString());
                System.out.println("CITY="+item.getValue().field("name")+ " 
ValueType="+item.getValue().type().typeName().toString());
        }
    }
---------------------------------------------------------
id=1  KeyType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY
CITY=Forest Hill 
ValueType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6
id=3  KeyType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY
CITY=St. Petersburg 
ValueType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6
id=2  KeyType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY
CITY=Denver  ValueType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6

    
    public static void Get(Ignite ignite, IgniteCache<BinaryObject,
BinaryObject> cache) {
        Long keyValue = 3L;
        BinaryObjectBuilder keyBuilder =
ignite.binary().builder("SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY")
                .setField("id", keyValue);
                
        BinaryObject value = cache.get(keyBuilder.build());
        if(value!=null) System.out.println("CITY="+value.field("name"));
        else System.out.println("Empty!!!!!!!!!!!!!!!");
    }
-------------------------------------
CITY=St. Petersburg




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to