Best way to customize caching/persistence of models


Victor:

I'm new to Ignite, try it out. My use case is that I have a model that needs to be cached/persisted. Also, this is not a traditional pojo model, I want to keep the storage and model separate. So I can't use it in the traditional sense to annotate the proper key/index in the pojo. And need to be able to execute queries on the cached data.

So far, based on what I've read and use cases, the only options I see are:

  1. Use Batch Exec for full SQL routing through jdbc, i.e. CREATE TABLE, INSERT, REMOVE, SELECT.

  2. Store it as BinaryObject i.e.

IgniteCache<BinaryObject, BinaryObject>

But it's not sure if I can get query support. Because it will be stored as blob/byte[].

So what I'm looking for is, are there other options that I might be missing? For #1, there is a way to use jdbc/SQL and locking, since I'm using atomicity=transactional.

For #2, is there a way to add query support to it. I looked at https://github.com/dmagda/ignite_world_demo/blob/master/src/main/java/demo/keyvalue/KeyValueBinaryDataProcessing.java but it doesn't involve queries.

An update for people who might run into this issue .

Tried the binary method and it worked. The reference link does use pojo (not exactly what I want). However, looking further, the point is to set the valueType to QueryEntity, not necessarily the class name, just map the value to be referenced back during object creation during put and similarly during query.

queryEntity.setValueType("employee");

//this can be now referenced while creating an object
ignite.binary().builder("employee");

// similarly used while querying
SqlFieldsQuery sqlQuery = new SqlFieldsQuery("select * from employee");
Alamar:

You can store it as a BinaryObject and you can get limited query support by specifying some fields ( mapped to SQL via QueryEntities) .

Then you can get the entire key/value by executing the following query:

SELECT _key, _val FROM pojo WHERE name = ?;

Note that you will need to use the native SQL API, which JDBC will not.

Related


Best way to customize caching/persistence of models

Victor: I'm new to Ignite, try it out. My use case is that I have a model that needs to be cached/persisted. Also, this is not a traditional pojo model, I want to keep the storage and model separate. So I can't use it in the traditional sense to annotate the p

Best way to customize caching/persistence of models

Victor: I'm new to Ignite, try it out. My use case is that I have a model that needs to be cached/persisted. Also, this is not a traditional pojo model, I want to keep the storage and model separate. So I can't use it in the traditional sense to annotate the p

Best way to customize caching/persistence of models

Victor: I'm new to Ignite, try it out. My use case is that I have a model that needs to be cached/persisted. Also, this is not a traditional pojo model, I want to keep the storage and model separate. So I can't use it in the traditional sense to annotate the p

Best way to customize caching/persistence of models

Victor: I'm new to Ignite, try it out. My use case is that I have a model that needs to be cached/persisted. Also, this is not a traditional pojo model, I want to keep the storage and model separate. So I can't use it in the traditional sense to annotate the p

Best way to customize caching/persistence of models

Victor: I'm new to Ignite, try it out. My use case is that I have a model that needs to be cached/persisted. Also, this is not a traditional pojo model, I want to keep the storage and model separate. So I can't use it in the traditional sense to annotate the p

The Best Way to Customize the Action Bar

Aduria I want to make the menu bar look like this : Since I can't post a picture, I've left a link. What is the best way? Thanks in advance. Swayan Create a custom action bar layout: custom_action_bar.xml Put the title and button in the layout. Zoom in on the

What is the best way to customize Bootstrap

username I'm having a lot of trouble with Bootstrap right now. I used it once to build a website and never used it again. But now, I have to use it. I downloaded the zipped version and included the JS and CSS files in the project. Here is the problem. I don't

The Best Way to Customize the Action Bar

Aduria I want to make the menu bar look like this : Since I can't post a picture, I've left a link. What is the best way? Thanks in advance. Swayan Create a custom action bar layout: custom_action_bar.xml Put the title and button in the layout. Zoom in on the

What is the best way to customize Bootstrap

username I'm having a lot of trouble with Bootstrap right now. I used it once to build a website and never used it again. But now, I have to use it. I downloaded the zipped version and included the JS and CSS files in the project. Here is the problem. I don't

Best way to wrap OpenGL models

eggless In short: what is the "preferred" way to wrap the OpenGL buffers, shaders and/or matrices required by higher level "model" objects? I'm trying to write such a small graphics engine in C++ built on core OpenGL 3.3, and I'd like to implement a solution a

Best way to serialize models in ExtJS

Judge If I have a Model and I want to serialize it to JSON for use in code, how can I do it better? Do I have to use Reader/Writer or is there another way? Jeff Zhou Ext.encodeto this end. ( returned string)json var json = Ext.encode(this.getStore().data.items

Best way to wrap OpenGL models

eggless In short: what is the "preferred" way to wrap the OpenGL buffers, shaders and/or matrices required by higher level "model" objects? I'm trying to write such a small graphics engine in C++ built on core OpenGL 3.3, and I'd like to implement a solution a

What is the best way to customize bound text in WPF

Davita As the title says, I need to customize part of the text in WPF, for example, I have a phrase "the fast brown fox jumps over the lazy dog" and I need to bold the word "brown", or change the background/foreground color of "fox". As far as I know, no regul

What is the best way to customize bound text in WPF

Davita As the title says, I need to customize part of the text in WPF, for example, I have a phrase "the fast brown fox jumps over the lazy dog" and I need to bold the word "brown", or change the background/foreground color of "fox". As far as I know, no regul

Best way for Typescript to parse responses in models

Wasted free time: The API I use returns information about my smart home devices. I want to parse the list of lights provided by this API . For this , I have created a response in my angular app that looks like:model export class LightsModel { public lightMod

Django - Best way to sort models by boolean operation

Davis Suppose I have this model and I want to sort them by logical operation n1 != n2: class Thing(Model): n1 = IntegerField() n2 = IntegerField() ... def is_different(self): return self.n1 != self.n2 If you sort them by the sortedbui

Best way to handle conditional fields in models

Kshitij Vaji Racharya: I have 3 models Personand represent Rolethe Positionpeople like a football club public class Person { private Long id; private String name; private Role role; } public class Role { private Long id; private String nam

Best way to name controllers and models in Codeigniter

Will Prim I'm trying to make some basic web application using code igniter, and I've realized that I have a lot of elements that call controller methods that get data from their corresponding models, and I'm trying to figure out what to name these methods The

Django - Best way to sort models by boolean operation

Davis Suppose I have this model and I want to sort them by logical operation n1 != n2: class Thing(Model): n1 = IntegerField() n2 = IntegerField() ... def is_different(self): return self.n1 != self.n2 If you sort them by the sortedbui

Best way to add methods to all eloquent models

Melihoff I have a method last()on one of my own models . class Article extends Model { public function last() { return Article::orderBy('created_at', 'desc')->first(); } } I wish to use the same method on other models. What is the best way

Best way to debug or skip sequential pytorch models

Long WU I used to write PyTorch models that nn.Moduleincluded __init__and forwarded so that I could step over my model to examine how variable dimensions varied along the network. But I realized later that you can also nn.Sequentialjust need one __init__, you

Best way to handle conditional fields in models

Kshitij Vaji Racharya: I have 3 models Personand represent Rolethe Positionpeople like a football club public class Person { private Long id; private String name; private Role role; } public class Role { private Long id; private String nam

Best way for Typescript to parse responses in models

Wasted free time: The API I use returns information about my smart home devices. I want to parse the list of lights provided by this API . For this , I have created a response in my angular app that looks like:model export class LightsModel { public lightMod

Best way to handle conditional fields in models

Kshitij Vaji Racharya: I have 3 models Personand represent Rolethe Positionpeople like a football club public class Person { private Long id; private String name; private Role role; } public class Role { private Long id; private String nam

Django - Best way to sort models by boolean operation

Davis Suppose I have this model and I want to sort them by logical operation n1 != n2: class Thing(Model): n1 = IntegerField() n2 = IntegerField() ... def is_different(self): return self.n1 != self.n2 If you sort them by the sortedbui

What's the best way to customize a widget's JS script?

code copy I have a plugin that provides it's own widgets. I need to make slight changes to some events in the widget jsfile . Since I don't want to edit the file widget.jsdirectly , my understanding is that I need to unregister the script through my theme func