Hi 

Pasted below the code and error i got.Actually i am trying query an existing
cache using node js which is loaded using Cache JDBC Pojo Store in Java.It
would be really helpful share me if you have any sample code.

PS C:\Users\ngovind\NodeApp> node NodeIgnite.js
ERROR: Binary type has different field types [typeName=OrderId,
fieldName=OrderID, fieldTypeName1=long, fieldTypeName2=double]
(node:13596) UnhandledPromiseRejectionWarning: ReferenceError: igniteClient
is not defined
    at start (C:\Users\ngovind\NodeApp\NodeIgnite.js:44:5)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:13596) UnhandledPromiseRejectionWarning: Unhandled promise rejection.
This error originated either by throwing inside of an async function without
a catch block, or by rejecting a promise which was not handled with
.catch(). (rejection id: 1)
(node:13596) [DEP0018] DeprecationWarning: Unhandled promise rejections are
deprecated. In the future, promise rejections
that are not handled will terminate the Node.js process with a non-zero exit
code.




const IgniteClient = require('apache-ignite-client');
const IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration;
const ObjectType = IgniteClient.ObjectType;
const CacheEntry = IgniteClient.CacheEntry;
const ComplexObjectType = IgniteClient.ComplexObjectType;

class OrderKey {
    constructor(OrderID = null, CityID= null) {
        this.OrderID = OrderID;
        this.CityID = CityID;
    }  
}

class OrderDetails {
    constructor(Productname = null, CustomerName= null,StoreName=null) {
        this.Productname = Productname;
        this.CustomerName = CustomerName;
        this.StoreName = StoreName;
    }  
}

async function start(){
try {
    const igniteClient = new IgniteClient();
    await igniteClient.connect(new
IgniteClientConfiguration('127.0.0.1:10800'));
    const cache = await igniteClient.getCache('OrdersCache');
    const OrderKeyComplexObjectType = 
    new ComplexObjectType(new OrderKey(0,0),'OrderId');
    const OrderComplexObjectType = new ComplexObjectType(new
OrderDetails('','',''),'Orders')
    ;

   cache.setKeyType(OrderKeyComplexObjectType).
   setValueType(OrderComplexObjectType);

    const data = await cache.get(new OrderKey(1,1));
   console.log(data.Productname);

}
catch (err) {
    console.log('ERROR: ' + err.message);
}
finally {

    igniteClient.disconnect();
     
    console.log(" Data Fetch Completed");

}
}

start();



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

Reply via email to