You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by James Isaac <ja...@gmail.com> on 2017/07/31 06:43:44 UTC

Fwd: Create and query a binary cache in ignite

Hi,

I am trying to use BinaryObjects to create the cache at runtime. For
example, instead of writing a pojo class such as Employee and configuring
it as a cache value type, I need to be able to dynamically configure the
cache with the field names and field types for the particular cache.

I have posted the sample code on stackoverflow: https://
stackoverflow.com/questions/45371054/create-and-query-a-
binary-cache-in-ignite (Posting the code here would be messy)

I am trying to configure the cache with the employeeId (Integer) as key and
the whole employee record (BinaryObject) as value. When I run the above
class, I get the following exception :

Caused by: org.h2.jdbc.JdbcSQLException: Table "EMPLOYEE" not found;
SQL statement:
select * from "emplCache".Employee where salary > 500 limit 5

What am I doing wrong here? Is there anything more other than this line:

employeeEntity.setTableName("Employee");

I checked out https://github.com/apache/ignite/blob/master/examples/sr
c/main/java/org/apache/ignite/examples/datagrid/CacheQueryDdlExample.java

as Nikolay suggested but I see that they are setting the pojo class as the
indexed type. Is there any way I can avoid this?

Regards,

James

Re: Create and query a binary cache in ignite

Posted by Nikolai Tikhonov <nt...@apache.org>.
Hi James,

Could you share your code as simple maven project? It would be great and
allows to us help you quickly.

On Mon, Jul 31, 2017 at 9:43 AM, James Isaac <ja...@gmail.com> wrote:

>
> Hi,
>
> I am trying to use BinaryObjects to create the cache at runtime. For
> example, instead of writing a pojo class such as Employee and configuring
> it as a cache value type, I need to be able to dynamically configure the
> cache with the field names and field types for the particular cache.
>
> I have posted the sample code on stackoverflow: https://stackov
> erflow.com/questions/45371054/create-and-query-a-binary-cache-in-ignite
> (Posting the code here would be messy)
>
> I am trying to configure the cache with the employeeId (Integer) as key
> and the whole employee record (BinaryObject) as value. When I run the above
> class, I get the following exception :
>
> Caused by: org.h2.jdbc.JdbcSQLException: Table "EMPLOYEE" not found; SQL statement:
> select * from "emplCache".Employee where salary > 500 limit 5
>
> What am I doing wrong here? Is there anything more other than this line:
>
> employeeEntity.setTableName("Employee");
>
> I checked out https://github.com/apache/ignite/blob/master/examples/sr
> c/main/java/org/apache/ignite/examples/datagrid/CacheQueryDdlExample.java
>
> as Nikolay suggested but I see that they are setting the pojo class as the
> indexed type. Is there any way I can avoid this?
>
> Regards,
>
> James
>
>