Load cache data into another POJO with SQL

classic Classic list List threaded Threaded
4 messages Options
java148 java148
Reply | Threaded
Open this post in threaded view
|

Load cache data into another POJO with SQL

Hello,

I am using Ignite SQL, wondering it is possible to load cache data into
another POJO ?  just like ORM, sql like this :

select new MyPojo(p.name, p.age) from myCacheTable as p where p.age > 30

Thanks. Ed



dmagda dmagda
Reply | Threaded
Open this post in threaded view
|

Re: Load cache data into another POJO with SQL

I doubt that this is supported. 

-
Denis


On Thu, Feb 13, 2020 at 11:32 AM Edward Chen <[hidden email]> wrote:
Hello,

I am using Ignite SQL, wondering it is possible to load cache data into
another POJO ?  just like ORM, sql like this :

select new MyPojo(p.name, p.age) from myCacheTable as p where p.age > 30

Thanks. Ed



ezhuravlev ezhuravlev
Reply | Threaded
Open this post in threaded view
|

Re: Load cache data into another POJO with SQL

Hi,

You can implement your own CacheStore and transform data in it: https://apacheignite.readme.io/docs/3rd-party-store#section-custom-cachestore

Best Regards,
Evgenii

чт, 13 февр. 2020 г. в 13:29, Denis Magda <[hidden email]>:
I doubt that this is supported. 

-
Denis


On Thu, Feb 13, 2020 at 11:32 AM Edward Chen <[hidden email]> wrote:
Hello,

I am using Ignite SQL, wondering it is possible to load cache data into
another POJO ?  just like ORM, sql like this :

select new MyPojo(p.name, p.age) from myCacheTable as p where p.age > 30

Thanks. Ed



ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Load cache data into another POJO with SQL

In reply to this post by java148
Hello!

I'm not sure the rest of Ignite community will approve, but you can actually try to write an SQL extension function, which will serve as factory method for MyPojo.

 
This is used in conjunction with Geometry with some success. It will only use with SqlFielsQuery but not with JDBC or other "thin" API.

Please note that you will have to register this function with some schema in some cache confguration.

Regards,
--
Ilya Kasnacheev


чт, 13 февр. 2020 г. в 22:32, Edward Chen <[hidden email]>:
Hello,

I am using Ignite SQL, wondering it is possible to load cache data into
another POJO ?  just like ORM, sql like this :

select new MyPojo(p.name, p.age) from myCacheTable as p where p.age > 30

Thanks. Ed