Yes, we do have validation build into our business layer -- so this
exact database error should never happen.  The problem I would like to
solve is: when a client gets a saving error (even if it is a column
length issue) I want to know which database table the error came
from.  There are over 100 children database tables that are being
handled by the one NHibernate Save command, and it is virtually
impossible to figure out where a random database saving error occurs
when we are not given any details.  Hope that helps.


On Apr 21, 9:47 pm, "Andrew C. Smith" <[email protected]> wrote:
> I don't think NHibernate provides you the exact problem, But I can tell you
> why this is probably happening. I've had this error before and it was when I
> was trying to put more information into a column than it allowed. such as
> shoving a 50 character property into a 4 character field. This can be easy
> to figure out if you take a look at your schema and do some validation on
> your entities before you execute a save.
>
> Maybe look into using an interceptor to perform the validation of your
> entity for the required lengths.
>
> On Tue, Apr 21, 2009 at 6:04 PM, DanVan <[email protected]> wrote:
>
> > I am calling Save on an nHibernate object that has many children
> > attached to it.  Upon save, sometimes an error happens when nHibernate
> > starts inserting into my sql database ("The data was truncated while
> > converting from one data type to another." for instance).  Following
> > are the top lines of the Exception.  My question is, how do I figure
> > out which table/column is the culprit within my save error?
>
> >   at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
> >   at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr&
> > pCursor, Boolean& isBaseTableCursor)
> >   at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand
> > (CommandBehavior behavior, String method, ResultSetOptions options)
> >   at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
> >   at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand
> > cmd)
> >   at NHibernate.Id.Insert.AbstractSelectingDelegate.PerformInsert
> > (SqlCommandInfo insertSQL, ISessionImplementor session, IBinder
> > binder)
> >   at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object
> > [] fields, Boolean[] notNull, SqlCommandInfo sql, Object obj,
> > ISessionImplementor session)
> >   at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object
> > [] fields, Object obj, ISessionImplementor session)
> >   at NHibernate.Action.EntityIdentityInsertAction.Execute()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to