I have a SQL query:
var filterValues = session
.CreateSQLQuery(sql)
////.SetCacheable(true)
.SetParameter("parent", qualifiedName)
.SetResultTransformer(Transformers.AliasToBean(typeof(FilterValue)))
.List<FilterValue>();
The actual SQL does not appear to matter. If I uncomment the
SetCacheable call I get an exception:
System.IndexOutOfRangeException: Index was outside the bounds of the
array.
at NHibernate.Type.TypeFactory.Disassemble(Object[] row,
ICacheAssembler[] types, Boolean[] nonCacheable, ISessionImplementor
session, Object owner)
at NHibernate.Cache.StandardQueryCache.Put(QueryKey key,
ICacheAssembler[] returnTypes, IList result, Boolean
isNaturalKeyLookup, ISessionImplementor session)
at
NHibernate.Loader.Loader.PutResultInQueryCache(ISessionImplementor
session, QueryParameters queryParameters, IType[] resultTypes,
IQueryCache queryCache, QueryKey key, IList result)
at NHibernate.Loader.Loader.ListUsingQueryCache(ISessionImplementor
session, QueryParameters queryParameters, ISet`1 querySpaces, IType[]
resultTypes)
at NHibernate.Loader.Loader.List(ISessionImplementor session,
QueryParameters queryParameters, ISet`1 querySpaces, IType[]
resultTypes)
at NHibernate.Loader.Custom.CustomLoader.List(ISessionImplementor
session, QueryParameters queryParameters)
at NHibernate.Impl.SessionImpl.ListCustomQuery(ICustomQuery
customQuery, QueryParameters queryParameters, IList results)
at NHibernate.Impl.SessionImpl.List(NativeSQLQuerySpecification
spec, QueryParameters queryParameters, IList results)
at NHibernate.Impl.SessionImpl.List[T](NativeSQLQuerySpecification
spec, QueryParameters queryParameters)
at NHibernate.Impl.SqlQueryImpl.List[T]()
I've seen this already (http://www.mailinglistarchive.com/html/
nhu...@googlegroups.com/2010-01/msg00404.html) but I'm not using
named queries.
Is what I'm doing supported? Is there some way I can specify whatever
extra info is required to support caching?
Thanks,
Kent
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
My problem is that I'm using SQL queries without a named query. Doing
so throws an exception as per my original post. Is this scenario not
supported?
Thanks,
Kent
On Apr 9, 7:17 pm, John Davidson <jwdavid...@gmail.com> wrote:
> The links below give hints as to the secret sauce for configuring cache
>
> > nhusers+u...@googlegroups.com<nhusers%2Bunsu...@googlegroups.com>
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
We appear to have our wires crossed.
My SQL query DOES work. My second level cache DOES work. The
combination of SQL query + second level cache DOES NOT work.
The link in my first post suggests that it CAN work for named SQL
queries, but my SQL query is not named. All I'm wondering is whether
it can be made to work for a SQL query that is not named.
Best,
Kent
On Apr 12, 11:47 am, John Davidson <jwdavid...@gmail.com> wrote:
> SQL queries work without required them to be named queries. You were asking
> about caching, so I thought you had the query working before you tried
> putting it into a cache. I suggest that you should try to approach it by
> making the sql query you want work first, then try adding it to your cache
> setup.
>
> Try:http://knol.google.com/k/fabio-maulo/nhibernate-chapter-14/1nr4enxv3d...
>
> John Davidson
>
> On Mon, Apr 12, 2010 at 4:34 AM, Kent Boogaart <ken...@internode.on.net>wrote:
>
> > Thanks for the links, but neither appears to address the problem. The
> > second link didn't work but I found what I think is the same article
> > at
> >http://davybrion.com/blog/2009/02/quickly-setting-up-and-using-nhiber...
> > .
>
> > My problem is that I'm using SQL queries without a named query. Doing
> > so throws an exception as per my original post. Is this scenario not
> > supported?
>
> > Thanks,
> > Kent
>
> > On Apr 9, 7:17 pm, John Davidson <jwdavid...@gmail.com> wrote:
> > > The links below give hints as to the secret sauce for configuring cache
>
> >http://ayende.com/Blog/archive/2006/08/21/TheSecretLifeOfNHibernatesC....
> > <nhusers%2Bunsu...@googlegroups.com<nhusers%252Buns...@googlegroups.com>
<property name="hibernate.cache.use_query_cache">true</property> |
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
My FilterValue class isn't an entity, so I just have this in my hbm:
<import class="FilterValue"/>
Kent
> > > > <nhusers%2Bunsu...@googlegroups.com<nhusers%252Buns...@googlegroups.com>
> > <nhusers%252Buns...@googlegroups.com<nhusers%25252Bun...@googlegroups.com>
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
Thanks,
Kent
> > > > > > <nhusers%2Bunsu...@googlegroups.com<nhusers%252Buns...@googlegroups.com>
> > <nhusers%252Buns...@googlegroups.com<nhusers%25252Bun...@googlegroups.com>
>
> > > > <nhusers%252Buns...@googlegroups.com<nhusers%25252Bun...@googlegroups.com>
> > <nhusers%25252Bun...@googlegroups.com<nhusers%2525252Bu...@googlegroups.com>
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
In a way, it makes sense that NH doesn't support what I was trying to
do because it doesn't have any concept of identity for the imported
type. It would be nice if I could give it that information.
Failing that, I think the only way for me to make this work is to
supplement my entities with extraneous information which doesn't
strictly belong in them, thus sacrificing my object model design for
cacheability.
Best,
Kent
On Apr 12, 4:22 pm, John Davidson <jwdavid...@gmail.com> wrote:
> This reference from the Knol of Fabio suggests that Component Mapping may be
> a solution as they are managed as values rather than entities
>
> http://knol.google.com/k/fabio-maulo/nhibernate-chapter-7/1nr4enxv3dp...
> > > > > > <nhusers%252Buns...@googlegroups.com<nhusers%25252Bun...@googlegroups.com>
> > <nhusers%25252Bun...@googlegroups.com<nhusers%2525252Bu...@googlegroups.com>
>
> > > > <nhusers%25252Bun...@googlegroups.com<nhusers%2525252Bu...@googlegroups.com>
> > <nhusers%2525252Bu...@googlegroups.com<nhusers%252525252B...@googlegroups.com>
> ...
>
> read more »
> > <nhusers%2B...@googlegroups.com<nhusers%252Bunsubscribe@googlegroups.com>
>
> > > > <nhusers%2B...@googlegroups.com<nhusers%252Bunsubscribe@googlegroups.com>
> > <nhusers%252...@googlegroups.com<nhusers%25252Bunsubscribe@googlegroups.com>
>
> > > > > > <nhusers%2B...@googlegroups.com<nhusers%252Bunsubscribe@googlegroups.com>
> > <nhusers%252...@googlegroups.com<nhusers%25252Bunsubscribe@googlegroups.com>
>
> > > > <nhusers%252...@googlegroups.com<nhusers%25252Bunsubscribe@googlegroups.com>
> > <nhusers%2525...@googlegroups.com<nhusers%2525252Bunsubscribe@googlegroups.com>
>
> > > > > > > > <nhusers%2B...@googlegroups.com<nhusers%252Bunsubscribe@googlegroups.com>
> > <nhusers%252...@googlegroups.com<nhusers%25252Bunsubscribe@googlegroups.com>
>
> > > > <nhusers%252...@googlegroups.com<nhusers%25252Bunsubscribe@googlegroups.com>
> > <nhusers%2525...@googlegroups.com<nhusers%2525252Bunsubscribe@googlegroups.com>
>
> > > > > > <nhusers%252...@googlegroups.com<nhusers%25252Bunsubscribe@googlegroups.com>
> > <nhusers%2525...@googlegroups.com<nhusers%2525252Bunsubscribe@googlegroups.com>
>
> > > > <nhusers%2525...@googlegroups.com<nhusers%2525252Bunsubscribe@googlegroups.com>
> > <nhusers%25252...@googlegroups.com<nhusers%252525252Bunsubscribe@googlegroups.com>
>
> > > > > > > > > > .
> > > > > > > > > > For more options, visit this group at
> > > > > > > > > >http://groups.google.com/group/nhusers?hl=en.
>
> > > > > > > > --
> > > > > > > > You received this message because you are subscribed to the
> > > > > > Groups
> > > > > > > > "nhusers" group.
> > > > > > > > To post to this group, send email to nhu...@googlegroups.com.
> > > > > > > > To unsubscribe from this group, send email to
> > > > > > > > nhusers+u...@googlegroups.com<nhusers%2Bunsu...@googlegroups.com>
> > <nhusers%2B...@googlegroups.com<nhusers%252Bunsubscribe@googlegroups.com>
>
> > > > <nhusers%2B...@googlegroups.com<nhusers%252Bunsubscribe@googlegroups.com>
> > <nhusers%252...@googlegroups.com<nhusers%25252Bunsubscribe@googlegroups.com>
>
> > > > > > <nhusers%2B...@googlegroups.com<nhusers%252Bunsubscribe@googlegroups.com>
> > <nhusers%252...@googlegroups.com<nhusers%25252Bunsubscribe@googlegroups.com>
>
> > > > <nhusers%252...@googlegroups.com<nhusers%25252Bunsubscribe@googlegroups.com>
> > <nhusers%2525...@googlegroups.com<nhusers%2525252Bunsubscribe@googlegroups.com>