NHibernate + ASP.NET update and delete not working

seanknight

New Member
i'm new to NHibernate and i'm having a problem to update and delete entities.Creating and reading works fine but when i update or delete this doesnt apply to the database.Here is the code in the DAO:\[code\]public virtual T Update(T item, int id) { if (item == null) throw new ArgumentNullException(string.Format("El {0} no puede ser nulo!", typeof(T).Name.ToString())); SessionManager.BeginTransaction(); try { SessionManager.CurrentSession.Update(item); SessionManager.CommitTransaction(); return item; } catch (Exception ex) { SessionManager.RollbackTransaction(); throw ex; } }\[/code\]And this is the SessionManager:\[code\]public static void BeginTransaction() { CurrentSession.BeginTransaction(); } public static void CommitTransaction() { if (CurrentSession.Transaction != null && CurrentSession.Transaction.IsActive) CurrentSession.Transaction.Commit(); CurrentSessionContext.Unbind(Factory); CurrentSession.Close(); } public static void RollbackTransaction() { if (CurrentSession.Transaction != null && CurrentSession.Transaction.IsActive) CurrentSession.Transaction.Rollback(); CurrentSessionContext.Unbind(Factory); CurrentSession.Close(); }\[/code\]I tried forcing session flush before commiting but it didnt help.Any ideas? You need any other code?Thx!
 
Back
Top