Let's say we have Parent, Child cached entities and parent.children cached collection:
Code:
@OneToMany(mappedBy="parent")
@LazyCollection(LazyCollectionOption.TRUE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
Set<Child> getChildren()
Let's suppose the collection is really big, and it's important to be able to quickly ascertain whether a given childID is part of it. But only a small percentage of Child entities will actually be needed. Is it possible to fetch a collection (parent.getChildren()) in such a way that Collection cache is populated (with a list of child IDs) but Child Entities are NOT inserted into cache? Something like:
parent.getChildren(); //adds 1 node to Collection cache. node contains all related childIDs
Set<Long> neededChildIDs = otherService.getChildIDs();
//Load and cache only children whose IDs appear in both parent.getChildren() and neededChildIDs.
thanks!