Java Mailing List Archive

http://www.gg3721.com/

Home » the NHibernate development list »

[NHibernate-development] Second level cache with criteria queries

Ayende Rahien

2008-01-23

Replies: Find Java Web Hosting

Author LoginPost Reply
Guys,
I must have some form of special blindness here ,because I can't figure out why this test is failing.
I tracked it down to different timestamps being used. But I can't figure out why.
Any ideas?

In SecondLevelCacheTest:

[Test]
public void SecondLevelCacheWithCriteriaQueries()
{
    using (ISession session = OpenSession())
    {
        IList list = session.CreateCriteria(typeof (Item))
            .Add(Expression.Gt("Id", 2))
            .SetCacheable(true)
            .List();
        Assert.AreEqual(3, list.Count);

        using(IDbCommand cmd = session.Connection.CreateCommand ())
        {
            cmd.CommandText = "DELETE FROM Item";
            cmd.ExecuteNonQuery();
        }
    }

    using(ISession session = OpenSession())
    {
        //should bring from cache
        IList list = session.CreateCriteria(typeof (Item))
            .Add(Expression.Gt("Id", 2))
            .SetCacheable(true)
            .List();
        Assert.AreEqual(3, list.Count);
    }
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@(protected)
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
©2008 gg3721.com - Jax Systems, LLC, U.S.A.