for SQL and/or H-SQL queries you should specify the query-space
sync.<synchronize
table="YourTable"/>

2009/9/22 merrycoder <[email protected]>

>
> Hi there,
>
> I have an issue with the following sql query:
>
> // query the user's with static value 'foo' as Name:
>
> IList<User> list = nhibernateSession.CreateSQLQuery("select 'foo' as
> {us.Name} from User us").AddEntity("us", typeof(User)).List<User>();
>
> foreach (User u in list)
>  Debug.WriteLine(u.Name); // Output is 'foo'. Correct!
>
> // Overwrite the Name in cache
> foreach (User u in list)
>   u.Name = "bar";
>
> // Rerun the same query
> list = nhibernateSession.CreateSQLQuery(sql).AddEntity("us", typeof
> (User)).List<User>();
>
> foreach (User u in list)
>  Debug.WriteLine(u.Name); // Output is 'bar'; Wrong IMHO!
>
> I would expect the Name to be 'foo' as it is overwritten in the query.
> Any ideas on how to handle this without clearing the cache?
>
> Thanks
>
> Stefan Landgraf
>
> >
>


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to