Hi Anne,
thank you very much for the reply. I tried to follow your suggestions,
but my collections are not yet fetched from the SL Cache. So here is
what my structure looks like.
ClassA -> Decorated with [Cache(Usage = CacheUsage.ReadWrite, Region =
"10Minutes")]
|_______> SubclassB -> Decorated with [Cache(Usage =
CacheUsage.ReadWrite, Region = "10Minutes")]
|_____________SubclassC -> Decorated with [Cache
(Usage = CacheUsage.ReadWrite, Region = "10Minutes")]
|_____________SubclassD -> Decorated with [Cache
(Usage = CacheUsage.ReadWrite, Region = "10Minutes")]
So first of all, my classes are all decorated with the Cache Tag. Now
i have in my ClassA a OneToMany reference to SubclassB. This reference
is configured as follows
[Bag(0, Lazy = true, Name = "SubclassB ", Cascade = "all", Fetch =
CollectionFetchMode.Unspecified)]
[Key(1, Column = "CLASSA_ID")]
[OneToMany(2, ClassType = typeof(SubclassB))]
[Cache(3, Region = "5Minutes", Usage = CacheUsage.ReadWrite)]
public virtual PersistentGenericBag<SubclassB> SubclassBList{ get;
set; }
I hope this is correct. Now in SubclassB there are to more references.
To SubclassC and SubclassD. Both are ManyToOne references. I will show
you the configs.
[ManyToOne(0, Name = "SubclassC", ClassType = typeof(SubclassC),
Column = "SUBCLASSC_ID", Cascade = "all", Fetch =
FetchMode.Unspecified)]
[Cache(1, Region = "5Minutes", Usage = CacheUsage.ReadWrite)]
public virtual SubclassC SubclassC{ get; set; }
[ManyToOne(0, Name = "SubclassD", ClassType = typeof(SubclassD),
Column = "SUBCLASSC_ID", Cascade = "all", Fetch =
FetchMode.Unspecified)]
[Cache(1, Region = "5Minutes", Usage = CacheUsage.ReadWrite)]
public virtual SubclassD SubclassD{ get; set; }
Ok now i think every class an every collection is configured for
caching. But i have already hits to the db and i do not understand why
i have these hits. What am i doing wrong? Do you have any more hints
for me?
Here is what i found in the nhibernate debug log. It firsts looks for
a cached collection of classA. An surprisingly i get an:
ReadOnlyCache ThreadID=8: Cache hit
This is what i see in my sql profiler. There is no second dbhit for
class a. Alright.
Now he is looking for a cached collection for SubclassB. The result
is:
DefaultInitializeCollectionEventListener ThreadID=8: collection not
cached
And here is what i see in my sql profiler. I get the dbhit. Why? For
SubclassC and D its the same behaviour.
Anne you, and maybe an other professional, are my last hope to get an
success story out of this. Please let my know if you have any other
hints for me.
Thanks in advance
Regards
eigeneachse