Joined: Tue Mar 06, 2007 10:47 am Posts: 1
|
|
Hi
1.0.4.0
Session.FlushMode = FlushMode.Comit;
public static int saveUser(Usuario u) { OleDbException odbex; int result = 1; try { session.Reconnect(); transaction = session.BeginTransaction(); session.Save(u); transaction.Commit(); result = 0; } catch(Exception ex) { transaction.Rollback(); if ((ex.InnerException != null) && (ex.InnerException is OleDbException)) { odbex = (OleDbException)ex.InnerException; result = odbex.ErrorCode; } else { result = 1; } } finally { session.Disconnect(); } return result; }
Microsoft access 2003
I have 1 table named users. This table has a column named username that has a unique constraint.
if the application user try to insert in db 1 user with the same username it get's an exception, and inform to the application user via the result.
since this exception ocurrs if I try to do any operation with the database (session.createCriteria(typeof(User))) i alwais get this exception
"null id in entry (don't flush the Session after an exception"
May anyone help me??
|
|