Joined: Wed Jun 02, 2010 7:49 am Posts: 2
|
I have a project made using nhibernate and Distributed Transaction Coordinator(MSDTC), I have this "uid=DBA;pwd=sql;DBF={0};AutoStop=No;POOLING=false;start=dbsrv11 -c 32M -tmf -tmt 20" as my connection string, but when i run several tests that have a transaction, it throws the following error: NHibernate.Exceptions.GenericADOException: could not load an entity: [Plutus.Dominio.Entidades.Agencia#6][SQL: SELECT agencia0_.Id as Id14_0_, agencia0_.Ativo as Ativo14_0_, agencia0_.Nome as Nome14_0_, agencia0_.NumeroAgencia as NumeroAg4_14_0_, agencia0_.NumeroAgenciaDV as NumeroAg5_14_0_, agencia0_.BancoEmpresa_Id as BancoEmp6_14_0_ FROM Agencias agencia0_ WHERE agencia0_.Id=?] ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at iAnywhere.Data.SQLAnywhere.SACommand._ExecuteReader(CommandBehavior commandBehavior, Boolean isExecuteScalar, Boolean isBeginExecuteReader) at iAnywhere.Data.SQLAnywhere.SACommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, String optionalEntityName, Object optionalIdentifier, IEntityPersister persister) --- End of inner exception stack trace --- at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, String optionalEntityName, Object optionalIdentifier, IEntityPersister persister) at NHibernate.Loader.Entity.AbstractEntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId) at NHibernate.Loader.Entity.AbstractEntityLoader.Load(Object id, Object optionalObject, ISessionImplementor session) at NHibernate.Persister.Entity.AbstractEntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session) at NHibernate.Event.Default.DefaultLoadEventListener.LoadFromDatasource(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) at NHibernate.Event.Default.DefaultLoadEventListener.DoLoad(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) at NHibernate.Event.Default.DefaultLoadEventListener.Load(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) at NHibernate.Event.Default.DefaultLoadEventListener.ProxyOrLoad(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) at NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent event, LoadType loadType) at NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType) at NHibernate.Impl.SessionImpl.Get(String entityName, Object id) at NHibernate.Impl.SessionImpl.Get(Type entityClass, Object id) at NHibernate.Impl.SessionImpl.Get[T](Object id)
My transaction is like this: Code: using (var transaction = new TransactionScope()) { //... save and save _session.Flush(); transaction.Complete(); } The error happens when run this code: _session.Get<T>(id); When I run the same tests without transaction, it doesn't throws any error. What can I do to fix it?
|
|