-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Indexes using single class and multiple Configuration #332
Comments
@rpjtesting let me think about this use case and whether it makes sense to implement it. Cheers. |
There a few issues to be resolve for this to be doable:
I did some research on inheritance in Spring Data and JPA and I imagine the complications with the repositories API prevent something like this from being implemented. Can you share your changes to see what you did? I still think the repositories API is a no go. |
@bsbodden I can't share code due to some restrictions. But I think this is possible and I have implemented it by tweaking the library code and it's working. But changing the lib code and using it deprives us from taking latest changes at same pace. Please rethink on this, and if any other ways to solve this then suggestions are welcome! |
Is there a way to create indexes for entities without need to create a class or repository, just use the single class as a reference for all the entities, that solves my problem. Jedis might be one solution but redis om has that built in, just need to expose some methods ;) |
@rpjtesting are you up for a exploratory PR for this? |
@bsbodden sure but will require sometime as I dont have it in my personal machine. But if possible, I will try to explain the changes I made and in which classes.
Let me know if this is possible or creating custom implementation is better |
I've consulting with the other OM implementers, and of course, in Java/Spring this a little bit harder to pull off. I think the we can start by opening the index creation with an API that can make it simpler for you rather that using Jedis directly. I need to experiment with a concrete example. Can you provide a (broken) sample with some dummy Entities and a basic usage? If I can hack it work correctly then we can see how we can provide a clean API for it. |
Hi there,
I have a single class called RedisEntityClass having following fields present:
class RedisEntityClass {
String field1;
String field2:
String field3;
}
With below cache configurations:
Cache1:
field1: val11
field2: val12
field3: val13
Cache2:
field1: val21
field2: val22
field3: val23
.. and so on.
I need to create Json Documents for all above caches using single Java Class as the structure for all the caches is same, hence I don't want to create similar Java classes as well for all the cache configurations.
I think it can work by creating a class for each cache with different names and extend to RedisEntityClass like below:
@document("cache1:")
class Cache1 extends RedisEntityClass {}
@document("cache2:")
class Cache2 extends RedisEntityClass {}
.... and so on.
This may work, but I have thousands of such caches and I don't want to create empty classes for each cache like this.
Is it possible to provide a feature in RedisOM-Spring library which will take input the above config data, map it to single entity class like RedisEntityClass, and create indexes for all the caches at once.
Currently I have copied the library code and tweaked a little to meet the requirements, but I know this is not the good approach in long run :(
Please help me with this :)
The text was updated successfully, but these errors were encountered: