The NHibernate session is probably dirty so it's flushing. Either you
modified an entity or there's a mismatch in your mapping.

See:

http://stackoverflow.com/questions/780755/nhibernate-flush-how-it-works
http://stackoverflow.com/questions/43320/nhibernate-isession-flush-where-and-when-to-use-it-and-why

If you want to ensure that the entity is never inserted or updated set
mutable=false:
http://www.castleproject.org/activerecord/documentation/trunk/manual/attributedocs/Generated_ActiveRecordAttribute.html#ActiveRecordAttribute_Properties

On Nov 4, 3:16 pm, jake <[email protected]> wrote:
> I created a view in mysql that join several tables.  I then created an
> ActiveRecord object to access the view like I would a table.  The
> issue is that whenever I compile I get the following error:
>
>  Can not modify more than one base table through a join view
> 'tablename'
>
> It looks like nhibernate is doing an update, but I don't know why, I'm
> only accessing the Find function of the object.  Any Ideas?
>
> Stack Trace:
> [MySqlException (0x80004005): Can not modify more than one base table
> through a join view 'tablename']
>    MySql.Data.MySqlClient.MySqlStream.OpenPacket() +278
>    MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64&
> affectedRows, Int64& lastInsertId) +97
>    MySql.Data.MySqlClient.MySqlDataReader.GetResultSet() +87
>    MySql.Data.MySqlClient.MySqlDataReader.NextResult() +1004
>    MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior
> behavior) +1620
>    MySql.Data.MySqlClient.MySqlCommand.ExecuteReader() +32
>    MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() +69
>    NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd) +61
>    NHibernate.Impl.NonBatchingBatcher.AddToBatch(IExpectation
> expectation) +66
>    NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object
> id, Object[] fields, Object[] oldFields, Boolean[] includeProperty,
> Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql,
> ISessionImplementor session) +1906
>
> [ADOException: could not update:
> [Table.Models.Rooms.Community_Room_Client_View#15][SQL: UPDATE
> viewname SET _id = ?, _id2 = ?, _id3 = ? WHERE _id4 = ?]]
>    NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object
> id, Object[] fields, Object[] oldFields, Boolean[] includeProperty,
> Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql,
> ISessionImplementor session) +2182
>    NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object
> id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection,
> Object[] oldFields, Object oldVersion, Object obj, ISessionImplementor
> session) +512
>    NHibernate.Impl.ScheduledUpdate.Execute() +559
>    NHibernate.Impl.SessionImpl.Execute(IExecutable executable) +206
>    NHibernate.Impl.SessionImpl.ExecuteAll(IList list) +135
>    NHibernate.Impl.SessionImpl.Execute() +292
>    NHibernate.Impl.SessionImpl.Flush() +130
>    Castle.ActiveRecord.Framework.Scopes.AbstractScope.PerformDisposal
> (ICollection`1 sessions, Boolean flush, Boolean close) +115
>    Castle.ActiveRecord.SessionScope.PerformDisposal(ICollection`1
> sessions) +103
>    Castle.ActiveRecord.Framework.Scopes.AbstractScope.Dispose() +76
>    Castle.ActiveRecord.Framework.SessionScopeWebModule.OnEndRequest
> (Object sender, EventArgs e) +126
>
> System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep 
> .Execute
> () +68
>    System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
> Boolean& completedSynchronously) +75
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to