Expand|Select|Wrap|Line Numbers
- NHibernate.Exceptions.GenericADOException: could not execute query ........ System.Transactions.TransactionException: The operation is not valid for the state of the transaction.
Any ideas why I could be getting this error?
Background: (Narrowing it down to the surrounding issues - following the stack trace.) My application has a lot of modules/classes talking to each other. One class is responsible for populating the a DTO (data transfer object) with data obtained from other methods. All this within a foreach loop.
It is very likely the loop is iterating over 1000 items. As a result, I felt maybe the database connection is timing out - not sure.
But every time, I get this error
Expand|Select|Wrap|Line Numbers
- NHibernate.Exceptions.GenericADOException: could not execute query
- [ select TOP (1) roleinfoin0_.InfoId as InfoId106_, roleinfoin0_.RoleId as RoleId106_, roleinfoin0_.EntityId as EntityId106_, roleinfoin0_.Info as Info106_ from EntityRoleInfo roleinfoin0_, RoleAdditionalInfo roleinfo1_, RoleDef roledef3_ where roleinfoin0_.RoleId=roleinfo1_.RoleId and roleinfoin0_.InfoId=roleinfo1_.InfoId and roleinfo1_.RoleId=roledef3_.RoleId and roleinfoin0_.EntityId=? and roleinfo1_.Prompt=? and roledef3_.RoleDescription=? ]
- Name:p1 - Value:120 Name:p2 - Value:Date of Birth Name:p3 - Value:Client
- [SQL: select TOP (1) roleinfoin0_.InfoId as InfoId106_, roleinfoin0_.RoleId as RoleId106_, roleinfoin0_.EntityId as EntityId106_, roleinfoin0_.Info as Info106_ from EntityRoleInfo roleinfoin0_, RoleAdditionalInfo roleinfo1_, RoleDef roledef3_ where roleinfoin0_.RoleId=roleinfo1_.RoleId and roleinfoin0_.InfoId=roleinfo1_.InfoId and roleinfo1_.RoleId=roledef3_.RoleId and roleinfoin0_.EntityId=? and roleinfo1_.Prompt=? and roledef3_.RoleDescription=?] ---> System.Transactions.TransactionException: The operation is not valid for the state of the transaction.
- at System.Transactions.TransactionState.EnlistVolatile(InternalTransaction tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
- at System.Transactions.Transaction.EnlistVolatile(IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions)
Thanks in advance.