Hi,
We implemented some type of Cache, to assure that only 1 of a specific object (based on its primary key) is available in the application.
But sometimes we wan't to get the latest version of objects: the version which is in the DataBase. So far no problem, but: If we want to select a list of objects based on a foreign key, we have some kind of problem: We must select this list with NHibernate, and than for every object of it which is alreaddy in the cache, do a Refresh.
But , since we implemented this Refresh msot of the time (!) this gives us this error: "possible non-threadsafe access to the session"
What is the reason for this? And how can we get arround this problem?
Thansk a lot in advance,
Pieter
Hibernate version: 1.2.0
The full error:
(Inner Exception)
Exception Source: NHibernate
Exception Type: NHibernate.AssertionFailure
Exception Message: possible non-threadsafe access to the session
Exception Target Site: InitializeEntity
---- Stack Trace ----
NHibernate.Impl.SessionImpl.InitializeEntity(obj As Object)
Ghost.EXE: N 00158
NHibernate.Loader.Loader.InitializeEntitiesAndCollections(hydratedObjects As IList, resultSetId As Object, session As ISessionImplementor)
Ghost.EXE: N 00331
NHibernate.Loader.Loader.DoQuery(session As ISessionImplementor, queryParameters As QueryParameters, returnProxies As Boolean)
Ghost.EXE: N 00915
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(session As ISessionImplementor, queryParameters As QueryParameters, returnProxies As Boolean)
Ghost.EXE: N 00083
NHibernate.Loader.Loader.DoList(session As ISessionImplementor, queryParameters As QueryParameters)
Ghost.EXE: N 00062
(Outer Exception)
Exception Source: NHibernate
Exception Type: NHibernate.ADOException
Exception Message: could not execute query
[ SELECT this_.ProformaArticleID as Proforma1_8_0_, this_.Version as Version8_0_, this_.ProformaID as ProformaID8_0_, this_.CotationArticleID as Cotation4_8_0_, this_.Quantite as Quantite8_0_, this_.PrixVenteUnitaire as PrixVent6_8_0_, this_.PrixVentePourcent as PrixVent7_8_0_, this_.PrixVenteForfait as PrixVent8_8_0_, this_.PrixVenteTotal as PrixVent9_8_0_, this_.Description as Descrip10_8_0_, this_.PrixVenteUnitaireDeviseOriginale as PrixVen11_8_0_, this_.PrixVenteTotalDeviseOriginale as PrixVen12_8_0_ FROM tblProformasArticles this_ WHERE this_.ProformaID = ? ]
Positional parameters: 0 2083
[SQL: SELECT this_.ProformaArticleID as Proforma1_8_0_, this_.Version as Version8_0_, this_.ProformaID as ProformaID8_0_, this_.CotationArticleID as Cotation4_8_0_, this_.Quantite as Quantite8_0_, this_.PrixVenteUnitaire as PrixVent6_8_0_, this_.PrixVentePourcent as PrixVent7_8_0_, this_.PrixVenteForfait as PrixVent8_8_0_, this_.PrixVenteTotal as PrixVent9_8_0_, this_.Description as Descrip10_8_0_, this_.PrixVenteUnitaireDeviseOriginale as PrixVen11_8_0_, this_.PrixVenteTotalDeviseOriginale as PrixVen12_8_0_ FROM tblProformasArticles this_ WHERE this_.ProformaID = ?]
Exception Target Site: DoList
---- Stack Trace ----
NHibernate.Loader.Loader.DoList(session As ISessionImplementor, queryParameters As QueryParameters)
Ghost.EXE: N 00172
NHibernate.Loader.Loader.ListIgnoreQueryCache(session As ISessionImplementor, queryParameters As QueryParameters)
Ghost.EXE: N 00046
NHibernate.Loader.Loader.List(session As ISessionImplementor, queryParameters As QueryParameters, querySpaces As ISet, resultTypes As IType[])
Ghost.EXE: N 00152
NHibernate.Loader.Criteria.CriteriaLoader.List(session As ISessionImplementor)
Ghost.EXE: N 00067
NHibernate.Impl.SessionImpl.Find(criteria As CriteriaImpl, results As IList)
Ghost.EXE: N 00492
NHibernate.Impl.SessionImpl.Find(criteria As CriteriaImpl)
Ghost.EXE: N 00109
NHibernate.Impl.CriteriaImpl.List()
Ghost.EXE: N 00094
Socfin.BaseFramework.BusinessLayer.Factory.BaseFactory`1.LoadList(strFieldName As String, objFieldValue As Object, cuCacheUsage As CacheUsage&, ctCacheType As CacheType)
BaseFactory.vb: line 0368, col 17, IL 0113
Ghost.facProformaArticle.SelectAllByProformaID(intProformaID As Int32, cuCacheUsage As CacheUsage)
facProformaArticle.vb: line 0076, col 09, IL 0001
Ghost.clsProforma.AfterLoad()
clsProforma.vb: line 3460, col 09, IL 0021
Socfin.BaseFramework.BusinessLayer.Factory.BaseFactory`1.Load(objID As Object, cuCacheUsage As CacheUsage&, ctCacheType As CacheType)
BaseFactory.vb: line 0236, col 29, IL 0246
Ghost.facProforma.SelectOneByID(intProformaID As Int32, cuCacheUsage As CacheUsage)
facProforma.vb: line 0068, col 09, IL 0001
Ghost.frmProforma.Fill(intID As Int32)
frmProforma.vb: line 0191, col 17, IL 0024
|