I am unable to create any inserts with my children which have a composite id.
I am able to update existing children and can query -- I just cannot insert new ones.
It seems like a simple problem -- hopefully the solution is simple.
The Parent (ESM_DEVICE_INFO) has a one-to-many relationship with (ESM_DEVICE_STATUS).
The classes themselves contain just a simple get/set w/out any extra code to them.
When I try to insert, I get the error stated below.
Thanks in advance!
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="CMDataWS"
assembly="CMDataWS">
<class name="esm_device_info" table="esm_device_info" lazy="false">
<id name="DEVICE_SEQ_ID" column="DEVICE_SEQ_ID" type="integer">
<generator class="sequence">
<param name="sequence">ESM_DEVICE_INFO_S01</param>
</generator>
</id>
<property name="DEVICE_NAME" column="DEVICE_NAME" type="string"/>
<property name="DEVICE_TYPE_CODE" column="DEVICE_TYPE_CODE" type="string"/>
<property name="DSCR" column="DSCR" type="string"/>
<property name="ENV_TYPE_CODE" column="ENV_TYPE_CODE" type="string"/>
<property name="LOCTN_CODE" column="LOCTN_CODE" type="string"/>
<property name="SSL_GROUP_SEQ_ID" column="SSL_GROUP_SEQ_ID" type="integer"/>
<property name="OWNER_COMPANY_CODE" column="OWNER_COMPANY_CODE" type="string"/>
<property name="COST_CENTER_CHARGEBACK" column="COST_CENTER_CHARGEBACK" type="string"/>
<property name="SERIAL_NBR" column="SERIAL_NBR" type="string"/>
<property name="APERTURE_ASSET_TAG" column="APERTURE_ASSET_TAG" type="string"/>
<property name="RACK_ID" column="RACK_ID" type="string"/>
<property name="CREATE_PROG_NAME" column="CREATE_PROG_NAME" type="string"/>
<property name="CREATE_USER_ID" column="CREATE_USER_ID" type="string"/>
<property name="CREATE_DATE" column="CREATE_DATE" type="DateTime"/>
<property name="CHG_LST_PROG_NAME" column="CHG_LST_PROG_NAME" type="string"/>
<property name="CHG_LST_USER_ID" column="CHG_LST_USER_ID" type="string"/>
<property name="CHG_LST_DATE" column="CHG_LST_DATE" type="DateTime"/>
<property name="DOMAIN_SUFFIX" column="DOMAIN_SUFFIX" type="string"/>
<bag name="ESM_DEVICE_STATUS_LIST" cascade="all" lazy="false" table="ESM_DEVICE_STATUS">
<key column="DEVICE_SEQ_ID" />
<one-to-many class="CMDataWS.esm_device_status, CMDataWS" />
</bag>
</class>
</hibernate-mapping>
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="CMDataWS"
assembly="CMDataWS">
<class name="esm_device_status" table="esm_device_status" lazy="false">
<composite-id name="ESM_DEVICE_STATUS_PK" >
<key-property name="DEVICE_SEQ_ID" type="integer" column="DEVICE_SEQ_ID"/>
<key-property name="DEVICE_STATUS_DATE" type="datetime" column="DEVICE_STATUS_DATE"/>
</composite-id>
<property name="DEVICE_SEQ_ID" type="integer" column="DEVICE_SEQ_ID"/>
<property name="DEVICE_STATUS_DATE" column="DEVICE_STATUS_DATE" type="datetime"/>
<property name="DEVICE_STATUS_CODE" column="DEVICE_STATUS_CODE" type="string"/>
<property name="CHANGE_REQUEST_NBR" column="CHANGE_REQUEST_NBR" type="string"/>
<property name="CREATE_PROG_NAME" column="CREATE_PROG_NAME" type="string"/>
<property name="CREATE_USER_ID" column="CREATE_USER_ID" type="string"/>
<property name="CREATE_DATE" column="CREATE_DATE" type="DateTime"/>
<property name="CHG_LST_PROG_NAME" column="CHG_LST_PROG_NAME" type="string"/>
<property name="CHG_LST_USER_ID" column="CHG_LST_USER_ID" type="string"/>
<property name="CHG_LST_DATE" column="CHG_LST_DATE" type="DateTime"/>
<many-to-one name="ESM_DEVICE_INFO" class="CMDataWS.esm_device_info, CMDataWS" column="DEVICE_SEQ_ID"/>
</class>
</hibernate-mapping>
Code:
{"Invalid index 12 for this OracleParameterCollection with Count=12."}
[System.IndexOutOfRangeException]: {"Invalid index 12 for this OracleParameterCollection with Count=12."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: null
Message: "Invalid index 12 for this OracleParameterCollection with Count=12."
Source: "System.Data.OracleClient"
StackTrace: " at System.Data.OracleClient.OracleParameterCollection.RangeCheck(Int32 index)\r\n at System.Data.OracleClient.OracleParameterCollection.GetParameter(Int32 index)\r\n at System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item(Int32 index)\r\n at NHibernate.Type.DateTimeType.Set(IDbCommand st, Object value, Int32 index) in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Type\\DateTimeType.cs:line 61\r\n at NHibernate.Type.NullableType.NullSafeSet(IDbCommand cmd, Object value, Int32 index) in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Type\\NullableType.cs:line 180\r\n at NHibernate.Type.NullableType.NullSafeSet(IDbCommand st, Object value, Int32 index, ISessionImplementor session) in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Type\\NullableType.cs:line 139\r\n at NHibernate.Type.ComponentType.NullSafeSet(IDbCommand st, Object value, Int32 begin, ISessionImplementor session) in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Type\\ComponentType.
cs:line 212\r\n at 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:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Persister\\Entity\\AbstractEntityPersister.cs:line 2361\r\n at 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:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Persister\\Entity\\AbstractEntityPersister.cs:line 2715\r\n at 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:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernat
e\\Persister\\Entity\\AbstractEntityPersister.cs:line 2627\r\n at 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:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Persister\\Entity\\AbstractEntityPersister.cs:line 2885\r\n at NHibernate.Action.EntityUpdateAction.Execute() in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Action\\EntityUpdateAction.cs:line 70\r\n at NHibernate.Engine.ActionQueue.Execute(IExecutable executable) in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Engine\\ActionQueue.cs:line 130\r\n at NHibernate.Engine.ActionQueue.ExecuteActions(IList list) in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Engine\\ActionQueue.cs:line 113\r\n at NHibernate.Engine.ActionQueue.ExecuteActions() in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Engine\\ActionQueue.cs:line 147\r\n at NHibernate.Eve
nt.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session) in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Event\\Default\\AbstractFlushingEventListener.cs:line 240\r\n at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event) in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Event\\Default\\DefaultFlushEventListener.cs:line 19\r\n at NHibernate.Impl.SessionImpl.Flush() in c:\\CSharp\\NH2.0.0\\nhibernate\\src\\NHibernate\\Impl\\SessionImpl.cs:line 1186\r\n at CMDataWS.Manager.SaveOrUpdateDeviceInfoRecord(String sXML) in C:\\SRC\\CMDataWS\\CMDataWS\\Manager.cs:line 137"
TargetSite: {Void RangeCheck(Int32)}