ICompositeUserType thorw "Invalid index 5 for this SqlParameterCollection with Count=4" on NullSafeSet method

Description

Hi,
I am trying to implement a new Composite type using the ICompositeUserType but i am getting the following error

"Invalid index 5 for this SqlParameterCollection with Count=4"

It seems there are two problems
1. The index on the nullsafeset have the wrong value
2. The core is thorwing an exception on the set ID of the object

here is the stack trace
System.Data.SqlClient.SqlParameterCollection.RangeCheck(Int32 index) +767551
System.Data.SqlClient.SqlParameterCollection.GetParameter(Int32 index) +16
System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item(Int32 index) +7
NHibernate.Type.Int32Type.Set(IDbCommand rs, Object value, Int32 index) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Type\Int32Type.cs:60
NHibernate.Type.NullableType.NullSafeSet(IDbCommand cmd, Object value, Int32 index) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Type\NullableType.cs:180
NHibernate.Type.NullableType.NullSafeSet(IDbCommand st, Object value, Int32 index, ISessionImplementor session) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Type\NullableType.cs:139
NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object id, Object[] fields, Object rowId, Boolean[] includeProperty, Boolean[][] includeColumns, Int32 table, IDbCommand statement, ISessionImplementor session, Int32 index) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:2361
NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:2715
NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:2627
NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, Object rowId, ISessionImplementor session) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:2885
NHibernate.Action.EntityUpdateAction.Execute() in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Action\EntityUpdateAction.cs:70
NHibernate.Engine.ActionQueue.Execute(IExecutable executable) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Engine\ActionQueue.cs:130
NHibernate.Engine.ActionQueue.ExecuteActions(IList list) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Engine\ActionQueue.cs:113
NHibernate.Engine.ActionQueue.ExecuteActions() in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Engine\ActionQueue.cs:147
NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Event\Default\AbstractFlushingEventListener.cs:240
NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Event\Default\DefaultFlushEventListener.cs:19
NHibernate.Impl.SessionImpl.Flush() in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Impl\SessionImpl.cs:1186
Castle.ActiveRecord.Framework.Scopes.AbstractScope.PerformDisposal(ICollection`1 sessions, Boolean flush, Boolean close) in c:\ccnet\CastleWorkDir\WorkingDirectory\ActiveRecord\Castle.ActiveRecord\Framework\Scopes\AbstractScope.cs:208
Castle.ActiveRecord.SessionScope.PerformDisposal(ICollection`1 sessions) in c:\ccnet\CastleWorkDir\WorkingDirectory\ActiveRecord\Castle.ActiveRecord\Framework\Scopes\SessionScope.cs:85
Castle.ActiveRecord.Framework.Scopes.AbstractScope.Dispose() in c:\ccnet\CastleWorkDir\WorkingDirectory\ActiveRecord\Castle.ActiveRecord\Framework\Scopes\AbstractScope.cs:179
Castle.ActiveRecord.Framework.SessionScopeWebModule.OnEndRequest(Object sender, EventArgs e) in c:\ccnet\CastleWorkDir\WorkingDirectory\ActiveRecord\Castle.ActiveRecord\Framework\SessionScopeWebModule.cs:105
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

Thanks,
Noam

Environment

None

Activity

Noam Berda 
April 9, 2008 at 12:23 AM

Hi,
Sorry but it seems to be my mistake, i have mapped the properties two times.
once time as a stand alon properties in the POJO and one time in the composite propoerty.

I guess that was the cause of the problem

Thanks,
Noam

Not an Issue

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created April 9, 2008 at 12:05 AM
Updated April 25, 2008 at 5:17 PM
Resolved April 25, 2008 at 5:17 PM
Who's Looking?