Thanks very much for the response, Oren.
I'm sorry if I'm just dense, but I think I do have it configured
properly. My objects do go into the second level cache when i
retrieve them, but not when I insert them. My inserts get into the
database, but not into the second level cache. If someone would tell
me what I'm missing I would be grateful. I've gone through all the
documentation I could find and the second level cache tests in the
NHibernate source and just can't come up with anything.
My NHibernate configuration is as follows:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</
property>
<property
name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
property>
<property
name="connection.driver_class">NHibernate.Driver.SqlClientDriver</
property>
<property
name="connection.connection_string_name">CacheTestObjects</
property>
<property name="default_schema">dbo</property>
<property
name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider,
NHibernate</property>
<mapping assembly="CachingTest.Objects" />
</session-factory>
</hibernate-configuration>
My mapping is this:
<class name="CacheTestObject" table="CacheTestObjects" lazy="false">
<cache usage="read-write"/>
<id name="ObjectId" column="ObjectId">
<generator class="identity" />
</id>
<property name="Name" />
<property name="Data" />
</class>
This is my code that is saving:
using (ISession session = sessionFactory.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
session.Save(testObject);
transaction.Commit();
session.Flush();
}
}
On Nov 6, 6:22 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> It doesAssuming you actually told NH to put it in the cahce in the config
>
>
>
> On Thu, Nov 6, 2008 at 6:15 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > I'm fairly new to NHibernate and this may be a bit of a silly
> > question, but it's not behaving as I expected and can't find a
> > definitive answer anywhere and don't see a test that addresses it, so
> > I'll just ask.
>
> > When I create a transient object and then save it to my session and
> > commit to my database, should it be added to my second level cache as
> > well. I was thinking that it would, but that doesn't seem to be the
> > case and I think maybe I'm missing something.
>
> > Thanks,
> > Dave- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---