Thanks for responding.
My entity isn't doing anything to the collection:
Code:
@OneToMany(mappedBy = "user", cascade = { CascadeType.ALL })
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public Set<VerificationTransaction> getTransactions() {
return transactions;
}
public void setTransactions(Set<VerificationTransaction> transactions) {
this.transactions = transactions;
}
and inside the session all that happens is this:
Code:
query = .....;
query.setReadOnly(true);
List users = query.list();
if (!count && !users.isEmpty()) {
for (User user : (List<User>) users) {
Hibernate.initialize(user.getTransactions());
for(VerificationTransaction vt: user.getTransactions()){
Hibernate.initialize(vt.getHistory());
}
}
}
So you can see that i do initialize 2 nodes down the tree for each user. The initialized objects down the tree do point back up the tree. Do they maybe overwrite the collections above it?
Is it something to do with the initialize() function - does it not interact well with the cache? Is there a way to call setReadOnly (like the Session method) for a collection (it takes an object as a parameter, does that cascade?) or for the entire session?
The collections that are not caching are the exact ones that I initialize in the code above..
Thanks for any advice.