-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Cache Prevalence Issue.
PostPosted: Thu Apr 20, 2006 8:30 am 
Newbie

Joined: Wed Feb 22, 2006 3:57 pm
Posts: 4
Hi,

I'm using NHibernate 1.0.2.0, Bamboo.Prevalence 1.4.4.4 and NHibernate.Caches.Prevalence 1.0.2.0.

Here is the mapping:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="NHibernate.Test.Module,NHibernate.Test" table="MODULES">
<cache usage="read-write"/>
<id name="Id" column="ID" type="Int32" unsaved-value="0">
<generator class="native">
<param name="sequence">MODULES_GENERATOR</param>
</generator>
</id>
<timestamp name="Timestamp" column="`TIME_STAMP`"/>
<property name="Name" column="`NAME`" type="String" unique="true" length="50" not-null="true"/>

<property name="Disabled" column="`DISABLED`" type="Boolean" not-null="true"/>
</class>
</hibernate-mapping>

Here is the nhibernate section in my config file:
<nhibernate>
<add key="hibernate.connection.isolation" value="ReadCommitted" />
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect" />
<add key="hibernate.connection.connection_string" value="Server=SKIPPER;Initial Catalog=NHibernate;Integrated Security=SSPI" />
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="hibernate.query.substitutions" value="true 1, false 0" />
<add key="hibernate.cache.use_query_cache" value="true" />
<add key="hibernate.cache.provider_class" value="NHibernate.Caches.Prevalence.PrevalenceCacheProvider, NHibernate.Caches.Prevalence" />
<add key="prevalenceBase" value="C:\Temp\PrevalenceCache" />
</nhibernate>

I have created 10 items in MODULES table:
private static void TestModule()
{
try
{
using (ISession session = _sessionFactory.OpenSession())
{
using (ITransaction tx = session.BeginTransaction())
{
for (int i=0; i < 10; i++)
{ Module module = new Module();
module.Name = "MyModule " + module.GetHashCode() + " - " + DateTime.Now.ToString();
module.Disabled = true;
session.Save(module);
_log.Debug("Module created " + module.Id);
}
tx.Commit();
}
}
}
catch (Exception ex)
{_log.Fatal(ex);}
}

I try to test the Prevalence Cache:
private static void TestPrevalenceCache()
{
try
{
using (ISession session = _sessionFactory.OpenSession())
{
try
{
ICriteria criteria = session.CreateCriteria(typeof(Module));
ICriterion criterion = new GtExpression("Timestamp", DateTime.Now.AddDays(-1));
criteria.Add(criterion);
criteria.SetCacheable(true);
IList items = criteria.List();
_log.Debug("Number of Modules " + items.Count);
foreach (Module module in items)
_log.Debug(module.Id + " - " + module.Name);
}
catch (Exception ex)
{
_log.Error(ex);
}
}
}
catch (Exception ex)
{_log.Error(ex);}
}

Here is the stack trace generated:

2006-04-20 08:25:23,705 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Caching: 1
2006-04-20 08:25:23,705 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - Fetching object 'NHibernate-Cache:NHibernate.Test.Module:1@1' from the cache.
2006-04-20 08:25:23,725 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value Item{version=4/20/2006 8:25:22 AM,freshTimestamp=4692056161177600} for key NHibernate-Cache:NHibernate.Test.Module:1@1
2006-04-20 08:25:23,735 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Cached: 1
2006-04-20 08:25:23,735 [4160] DEBUG NHibernate.Impl.SessionImpl - done materializing entity [NHibernate.Test.Module#1]
2006-04-20 08:25:23,735 [4160] DEBUG NHibernate.Impl.SessionImpl - resolving associations for: [NHibernate.Test.Module#2]
2006-04-20 08:25:23,735 [4160] DEBUG NHibernate.Impl.SessionImpl - adding entity to second-level cache [NHibernate.Test.Module#2]
2006-04-20 08:25:23,735 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Caching: 2
2006-04-20 08:25:23,735 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - Fetching object 'NHibernate-Cache:NHibernate.Test.Module:2@2' from the cache.
2006-04-20 08:25:23,735 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value Item{version=4/20/2006 8:25:22 AM,freshTimestamp=4692056161218560} for key NHibernate-Cache:NHibernate.Test.Module:2@2
2006-04-20 08:25:23,745 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Cached: 2
2006-04-20 08:25:23,745 [4160] DEBUG NHibernate.Impl.SessionImpl - done materializing entity [NHibernate.Test.Module#2]
2006-04-20 08:25:23,745 [4160] DEBUG NHibernate.Impl.SessionImpl - resolving associations for: [NHibernate.Test.Module#3]
2006-04-20 08:25:23,745 [4160] DEBUG NHibernate.Impl.SessionImpl - adding entity to second-level cache [NHibernate.Test.Module#3]
2006-04-20 08:25:23,745 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Caching: 3
2006-04-20 08:25:23,745 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - Fetching object 'NHibernate-Cache:NHibernate.Test.Module:3@3' from the cache.
2006-04-20 08:25:23,755 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value Item{version=4/20/2006 8:25:22 AM,freshTimestamp=4692056161300480} for key NHibernate-Cache:NHibernate.Test.Module:3@3
2006-04-20 08:25:23,765 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Cached: 3
2006-04-20 08:25:23,765 [4160] DEBUG NHibernate.Impl.SessionImpl - done materializing entity [NHibernate.Test.Module#3]
2006-04-20 08:25:23,765 [4160] DEBUG NHibernate.Impl.SessionImpl - resolving associations for: [NHibernate.Test.Module#4]
2006-04-20 08:25:23,765 [4160] DEBUG NHibernate.Impl.SessionImpl - adding entity to second-level cache [NHibernate.Test.Module#4]
2006-04-20 08:25:23,765 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Caching: 4
2006-04-20 08:25:23,765 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - Fetching object 'NHibernate-Cache:NHibernate.Test.Module:4@4' from the cache.
2006-04-20 08:25:23,775 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value Item{version=4/20/2006 8:25:22 AM,freshTimestamp=4692056161382400} for key NHibernate-Cache:NHibernate.Test.Module:4@4
2006-04-20 08:25:23,785 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Cached: 4
2006-04-20 08:25:23,785 [4160] DEBUG NHibernate.Impl.SessionImpl - done materializing entity [NHibernate.Test.Module#4]
2006-04-20 08:25:23,785 [4160] DEBUG NHibernate.Impl.SessionImpl - resolving associations for: [NHibernate.Test.Module#5]
2006-04-20 08:25:23,785 [4160] DEBUG NHibernate.Impl.SessionImpl - adding entity to second-level cache [NHibernate.Test.Module#5]
2006-04-20 08:25:23,785 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Caching: 5
2006-04-20 08:25:23,785 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - Fetching object 'NHibernate-Cache:NHibernate.Test.Module:5@5' from the cache.
2006-04-20 08:25:23,795 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value Item{version=4/20/2006 8:25:22 AM,freshTimestamp=4692056161464320} for key NHibernate-Cache:NHibernate.Test.Module:5@5
2006-04-20 08:25:23,805 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Cached: 5
2006-04-20 08:25:23,805 [4160] DEBUG NHibernate.Impl.SessionImpl - done materializing entity [NHibernate.Test.Module#5]
2006-04-20 08:25:23,805 [4160] DEBUG NHibernate.Impl.SessionImpl - resolving associations for: [NHibernate.Test.Module#6]
2006-04-20 08:25:23,805 [4160] DEBUG NHibernate.Impl.SessionImpl - adding entity to second-level cache [NHibernate.Test.Module#6]
2006-04-20 08:25:23,805 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Caching: 6
2006-04-20 08:25:23,805 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - Fetching object 'NHibernate-Cache:NHibernate.Test.Module:6@6' from the cache.
2006-04-20 08:25:23,825 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value Item{version=4/20/2006 8:25:22 AM,freshTimestamp=4692056161587200} for key NHibernate-Cache:NHibernate.Test.Module:6@6
2006-04-20 08:25:23,835 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Cached: 6
2006-04-20 08:25:23,835 [4160] DEBUG NHibernate.Impl.SessionImpl - done materializing entity [NHibernate.Test.Module#6]
2006-04-20 08:25:23,835 [4160] DEBUG NHibernate.Impl.SessionImpl - resolving associations for: [NHibernate.Test.Module#7]
2006-04-20 08:25:23,835 [4160] DEBUG NHibernate.Impl.SessionImpl - adding entity to second-level cache [NHibernate.Test.Module#7]
2006-04-20 08:25:23,835 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Caching: 7
2006-04-20 08:25:23,835 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - Fetching object 'NHibernate-Cache:NHibernate.Test.Module:7@7' from the cache.
2006-04-20 08:25:23,845 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value Item{version=4/20/2006 8:25:22 AM,freshTimestamp=4692056161669120} for key NHibernate-Cache:NHibernate.Test.Module:7@7
2006-04-20 08:25:23,845 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Cached: 7
2006-04-20 08:25:23,845 [4160] DEBUG NHibernate.Impl.SessionImpl - done materializing entity [NHibernate.Test.Module#7]
2006-04-20 08:25:23,845 [4160] DEBUG NHibernate.Impl.SessionImpl - resolving associations for: [NHibernate.Test.Module#8]
2006-04-20 08:25:23,845 [4160] DEBUG NHibernate.Impl.SessionImpl - adding entity to second-level cache [NHibernate.Test.Module#8]
2006-04-20 08:25:23,845 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Caching: 8
2006-04-20 08:25:23,845 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - Fetching object 'NHibernate-Cache:NHibernate.Test.Module:8@8' from the cache.
2006-04-20 08:25:23,855 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value Item{version=4/20/2006 8:25:22 AM,freshTimestamp=4692056161710080} for key NHibernate-Cache:NHibernate.Test.Module:8@8
2006-04-20 08:25:23,865 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Cached: 8
2006-04-20 08:25:23,865 [4160] DEBUG NHibernate.Impl.SessionImpl - done materializing entity [NHibernate.Test.Module#8]
2006-04-20 08:25:23,865 [4160] DEBUG NHibernate.Impl.SessionImpl - resolving associations for: [NHibernate.Test.Module#9]
2006-04-20 08:25:23,865 [4160] DEBUG NHibernate.Impl.SessionImpl - adding entity to second-level cache [NHibernate.Test.Module#9]
2006-04-20 08:25:23,865 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Caching: 9
2006-04-20 08:25:23,865 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - Fetching object 'NHibernate-Cache:NHibernate.Test.Module:9@9' from the cache.
2006-04-20 08:25:23,876 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value Item{version=4/20/2006 8:25:22 AM,freshTimestamp=4692056161796096} for key NHibernate-Cache:NHibernate.Test.Module:9@9
2006-04-20 08:25:23,886 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Cached: 9
2006-04-20 08:25:23,886 [4160] DEBUG NHibernate.Impl.SessionImpl - done materializing entity [NHibernate.Test.Module#9]
2006-04-20 08:25:23,886 [4160] DEBUG NHibernate.Impl.SessionImpl - resolving associations for: [NHibernate.Test.Module#10]
2006-04-20 08:25:23,886 [4160] DEBUG NHibernate.Impl.SessionImpl - adding entity to second-level cache [NHibernate.Test.Module#10]
2006-04-20 08:25:23,886 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Caching: 10
2006-04-20 08:25:23,886 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - Fetching object 'NHibernate-Cache:NHibernate.Test.Module:10@10' from the cache.
2006-04-20 08:25:23,896 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value Item{version=4/20/2006 8:25:22 AM,freshTimestamp=4692056161878016} for key NHibernate-Cache:NHibernate.Test.Module:10@10
2006-04-20 08:25:23,896 [4160] DEBUG NHibernate.Cache.ReadWriteCache - Cached: 10
2006-04-20 08:25:23,896 [4160] DEBUG NHibernate.Impl.SessionImpl - done materializing entity [NHibernate.Test.Module#10]
2006-04-20 08:25:23,896 [4160] DEBUG NHibernate.Impl.SessionImpl - initializing non-lazy collections
2006-04-20 08:25:23,896 [4160] DEBUG NHibernate.Cache.StandardQueryCache - caching query results in region: NHibernate.Cache.StandardQueryCache
2006-04-20 08:25:23,906 [4160] DEBUG NHibernate.Caches.Prevalence.PrevalenceCache - setting value System.Collections.ArrayList for key NHibernate-Cache:NHibernate.Cache.StandardQueryCache:sql: SELECT this.ID as ID0_, this.[DISABLED] as y4_0_, this.[TIME_STAMP] as y2_0_, this.[NAME] as y3_0_ FROM MODULES this WHERE this.[TIME_STAMP] > :this.[TIME_STAMP]; parameters: 4/19/2006 8:25:23 AM, ; first row: 0@1375269394
2006-04-20 08:25:25,197 [4160] DEBUG NHibernate.Util.ADOExceptionReporter - Unable to perform find
System.Runtime.Serialization.SerializationException: The type NHibernate.Type.TimestampType in Assembly NHibernate, Version=1.0.2.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc is not marked as serializable.

Server stack trace:
at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type, Boolean excludeNonSerializable)
at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
at Bamboo.Prevalence.Implementation.CommandLogWriter.WriteCommand(ICommand command)
at Bamboo.Prevalence.PrevalenceEngine.DoExecuteCommand(ICommand command)
at Bamboo.Prevalence.PrevalenceEngine.ExecuteCommand(ICommand command)
at Bamboo.Prevalence.Implementation.PrevalentSystemProxy.ExecuteCommand(IMethodCallMessage call)
at Bamboo.Prevalence.Implementation.PrevalentSystemProxy.Invoke(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NHibernate.Caches.Prevalence.CacheSystem.Add(Object key, Object value)
at NHibernate.Caches.Prevalence.PrevalenceCache.Put(Object key, Object value)
at NHibernate.Cache.StandardQueryCache.Put(QueryKey key, IType[] returnTypes, IList result, ISessionImplementor session)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
at NHibernate.Loader.CriteriaLoader.List(ISessionImplementor session)
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria)
2006-04-20 08:25:25,207 [4160] WARN NHibernate.Util.ADOExceptionReporter - System.Runtime.Serialization.SerializationException: The type NHibernate.Type.TimestampType in Assembly NHibernate, Version=1.0.2.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc is not marked as serializable.

Server stack trace:
at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type, Boolean excludeNonSerializable)
at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
at Bamboo.Prevalence.Implementation.CommandLogWriter.WriteCommand(ICommand command)
at Bamboo.Prevalence.PrevalenceEngine.DoExecuteCommand(ICommand command)
at Bamboo.Prevalence.PrevalenceEngine.ExecuteCommand(ICommand command)
at Bamboo.Prevalence.Implementation.PrevalentSystemProxy.ExecuteCommand(IMethodCallMessage call)
at Bamboo.Prevalence.Implementation.PrevalentSystemProxy.Invoke(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NHibernate.Caches.Prevalence.CacheSystem.Add(Object key, Object value)
at NHibernate.Caches.Prevalence.PrevalenceCache.Put(Object key, Object value)
at NHibernate.Cache.StandardQueryCache.Put(QueryKey key, IType[] returnTypes, IList result, ISessionImplementor session)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
at NHibernate.Loader.CriteriaLoader.List(ISessionImplementor session)
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria)
2006-04-20 08:25:25,207 [4160] ERROR NHibernate.Util.ADOExceptionReporter - The type NHibernate.Type.TimestampType in Assembly NHibernate, Version=1.0.2.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc is not marked as serializable.
2006-04-20 08:25:25,207 [4160] ERROR NHibernate.Test.TestCache - NHibernate.ADOException: Unable to perform find ---> System.Runtime.Serialization.SerializationException: The type NHibernate.Type.TimestampType in Assembly NHibernate, Version=1.0.2.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc is not marked as serializable.

Server stack trace:
at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type, Boolean excludeNonSerializable)
at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
at Bamboo.Prevalence.Implementation.CommandLogWriter.WriteCommand(ICommand command)
at Bamboo.Prevalence.PrevalenceEngine.DoExecuteCommand(ICommand command)
at Bamboo.Prevalence.PrevalenceEngine.ExecuteCommand(ICommand command)
at Bamboo.Prevalence.Implementation.PrevalentSystemProxy.ExecuteCommand(IMethodCallMessage call)
at Bamboo.Prevalence.Implementation.PrevalentSystemProxy.Invoke(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NHibernate.Caches.Prevalence.CacheSystem.Add(Object key, Object value)
at NHibernate.Caches.Prevalence.PrevalenceCache.Put(Object key, Object value)
at NHibernate.Cache.StandardQueryCache.Put(QueryKey key, IType[] returnTypes, IList result, ISessionImplementor session)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
at NHibernate.Loader.CriteriaLoader.List(ISessionImplementor session)
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria)
--- End of inner exception stack trace ---
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria)
at NHibernate.Impl.CriteriaImpl.List()
at NHibernate.Test.TestCache.TestPrevalenceCache() in e:\my projects\csharp\misc\nhibernate\testcache\testcache.cs:line 130
2006-04-20 08:25:25,207 [4160] DEBUG NHibernate.Impl.SessionImpl - running ISession.Dispose()
2006-04-20 08:25:25,207 [4160] DEBUG NHibernate.Impl.BatcherImpl - running BatcherImpl.Dispose(true)
2006-04-20 08:25:25,207 [4160] DEBUG NHibernate.Connection.ConnectionProvider - Closing connection

I'm using SQL Server 2000 SP4.

What am I missing here??

Thanks.

Ciao,
Richard.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 9:49 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Most of NHibernate types are not marked Serializable (which is a bug). So, query cache with Prevalence won't work. So either disable the query cache, or, if you really need it, build a version of NHibernate with every class implementing IType marked [Serializable].


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:30 am 
Newbie

Joined: Wed Feb 22, 2006 3:57 pm
Posts: 4
Hi,

Just to summarize to get Prevalence Cache working with NHibernate 1.0.2.0, Bamboo.Prevalence 1.4.4.4 and NHibernate.Caches.Prevalence 1.0.2.0.

1. Recompile Nhibernate with every class implementing IType marked [Serializable]
2. For NHibernate.Caches.Prevalence apply the fix suggested Here.
3. Delete all cache folder previously used (in my example C:\Temp\PrevalenceCache).
4. nhibernate section in your config must contain:
<add key="hibernate.cache.use_query_cache" value="true" />
<add key="hibernate.cache.provider_class" value="NHibernate.Caches.Prevalence.PrevalenceCacheProvider, NHibernate.Caches.Prevalence" />
<add key="prevalenceBase" value="C:\Temp\PrevalenceCache" />
5. All classes to cache must have a cache node just after class node:
<class name="NHibernate.Test.Module,NHibernate.Test" table="MODULES">
<cache usage="read-write"/>
6. To enable caching, all object queries use SetCacheable(true); method:
ICriteria criteria = session.CreateCriteria(typeof(Module));
ICriterion criterion = new GtExpression("Timestamp", DateTime.Now.AddDays(-1));
criteria.Add(criterion);
criteria.SetCacheable(true);
IList items = criteria.List();

Ciao,
Richard.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.