In our JIRA there is an open issue about this matter but I have not analysed
it so far...
By the way this test does not fail
long savedFrogId; using (ISession s = factory.OpenSession()) { using
(ITransaction tx = s.BeginTransaction()) { var frog = new Animal {
BodyWeight = 34, Description = "Frog" }; savedFrogId = (long)s.Save(frog);
tx.Commit(); } } using (ISession s = factory.OpenSession()) { using
(ITransaction tx = s.BeginTransaction()) { s.CreateQuery("delete from
Animal").ExecuteUpdate(); tx.Commit(); } } using (ISession s =
factory.OpenSession()) { using (ITransaction tx = s.BeginTransaction()) {
var frog = s.Load<Animal>(savedFrogId); frog.Id.Should().Be(savedFrogId);
NHibernateUtil.IsInitialized(frog).Should().Be.False(); tx.Commit(); } }
Have you a failing test ?
As general advise: instead read here and there you can write a simple test
outside your system and check the NH's behaviour; hopefully you will find a
bug in NHibernate and you will know that the problem is not in your system.
Good luck!!
P.S. I have added the delete only for you ;)
2010/3/7 Graham Bunce <[email protected]>
> btw, I'm really confused now. This blog: "http://
> blogs.hibernatingrhinos.com/nhibernate/Default.aspx" and this section
> "First and Second Level caching in NHibernate" states:
>
> "When using the session.Load(id) method NHibernate only instantiates a
> proxy for the given entity. As long as we only access the id of the
> entity the entity itself is not loaded from the database. Only when we
> try to access one of the other properties of the entity NHibernate
> loads the entity from the database"
>
> in my scenario I *am* only accessing the ID but the database is still
> being hit. I'm using NH 2.1.2GA.
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
Fabio Maulo
--
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.