Cache question

classic Classic list List threaded Threaded
2 messages Options
vinsala vinsala
Reply | Threaded
Open this post in threaded view
|

Cache question

Hi,

I have three entities/POJOs ,say A, B and C which corresponds to tables A,
B, and C in persistence DB


public class A {
      private int key;
      private String name;
}

public class B {
      private int key;
      private String city;
}

public class C {
      private int key;
      private A a;
      private B b;
}




1.I see data is loaded from DB into cache, when i load cache using
IgniteCache.loadCache(null) for A/B

Questions

1) How do i load C cache so that I can have A and B loaded into C? This is
not how Ignite cache supposed to work I believe? As the cache for C will
contain same fields as DB table columns without having reference to A or B
in class C?

2) Probably I need to have a separate business entity model and a separate
Ignite model?
Where C class above is business entity? And cache for table C will work with
model below only?


public class C {
      private int key;
      private int aKey;
      private int bKey;
}






--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Maxim.Pudov Maxim.Pudov
Reply | Threaded
Open this post in threaded view
|

Re: Cache question

Let me try to answer this question.
1. I would recommend to avoid this, because Ignite stores objects as binary
arrays, so you will have an object from A being stored as an array of bytes
in both: cache A and cache C, which obviously takes more memory. Another
reason not to use it is that you will need to provide your own CacheStore
implementation for cache C.
2. Yes, I believe this is a better way.



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