How can there be a relationship between live sector data between objects on a map?

Say we have objects below that need to be stored in a carriage.

class A implements Serializable{ public int id; public List<B> incomingBs; public A(int x){ this.id=x; } } class B implements Serializable{ public int id; public List<A> outgoingAs; public B(int x){ this.id=x; } } A a1=new A(1); A a2=new A(2); B b1=new B(1); B b2=new B(2); a1.incomingBs.add(b1); a1.incomingBs.add(b2); b1.outgoingAs.add(a1); b1.outgoingAs.add(a2); 

Then I put a1 and b1 to the forest stone card. How can hazelcast store such a nested structure. If I pull the data: a1 from hazelcast, can I get the nested b1 ? If so, then I should have access to a1 , which contains b1 , then b1 has a1 ... then ..... Is it possible for hazelcast to serialize for this infinite nesting? Like a recursion of infinity.

To make the question a lot easier if I save the data above on the tier map, can I get the source data with the relationships I just clicked?

+4
source share
1 answer

So far, everything is Serializable, yes, it works like magic :)

Just use transient in fields where this behavior is undesirable.

+3
source

Source: https://habr.com/ru/post/1483731/


All Articles