Sorry, i missed something in my code:
// *** The first query ***
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";
// *** The second query ***
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 'bar'; Wrong IMHO!
The second query is the same as the first one.
On 22 Sep., 17:07, Fabio Maulo <[email protected]> wrote:
> you are not showing the second query.If you think that is a bug you can
> create a failing test showing the bug case... if you can't create a failing
> test there is no chance to know if it is a bug or a user fault (you are
> talking about "cached" but in the code you sent here there isn't any cached
> queries).
>
> 2009/9/22 merrycoder <[email protected]>
>
>
>
>
>
> > This applies to named queries. I don't have a named query here and
> > named queries are not an option for me, as the sql is generated at
> > runtime.
> > Is there any other way to prevent cached items to slip into my query
> > result set?
>
> > On 22 Sep., 16:22, Fabio Maulo <[email protected]> wrote:
> > > <synchronize table="YourTable"/>
>
> > > 2009/9/22 merrycoder <[email protected]>
>
> > > > Sorry, i could not find anything useful on how to specify the query-
> > > > space:
>
> > > > How do i do that exactly?
>
> > > > On 22 Sep., 15:33, Fabio Maulo <[email protected]> wrote:
> > > > > 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
>
> > > --
> > > Fabio Maulo
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---