Hi,
I have an issue with NHibernate 2.1 that I'm not able to solve.
Here is the context :
- I'm building an application with : a presentation layer (ASP.NET), relying on a a business layer (singletons), relying on a datasource layer as singletons, in our case the datasource is NHibernate, throught DAO, with Open-in-View session configured with "auto-commit" (legacy)
- the cutomer entity is linked to basket items with one-to-many (bag, cascade="all")
- the cutomer entity is linked to order items with one-to-many (bag, cascade="all")
- I have to convert a customer's basket to an order, so I :
- check products availability
- begin a transaction (on current NHibernate session)
- "move" basket's products to order (I remove products from basket, then add them to newly created order)
- update product's stock
- commit or rollback (depending of potential errors)
When the convertion fail, the transaction is rolled back, and the data are not uptaded to database (OK)
But when the session is flushed at the end of the HTTP request (legacy...), I have an unexpected "
Could not synchronize database state with session state", inner exception is complaining about an insert query on the order item.
As far as I can see, it seems to be an issue with the child entites because when I ask NHibernate to save only the order, then rollback, I don't have any problem.
I hope I've been clear (my English is not perfect), thank you for your help and advices.
Best regards,