These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: params assignation error (on insert)
PostPosted: Wed Dec 31, 2008 10:08 am 
Newbie

Joined: Wed Dec 31, 2008 9:58 am
Posts: 1
I have the following exception:

{"Invalid index 4 for this OracleParameterCollection with Count=4."}

it happens when I try to insert an object configured like this:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="ConsoleApplication2.DAO.Step, ConsoleApplication2" table="TE_STEP">
<composite-id name="Key" class="ConsoleApplication2.DAO.StepKey, ConsoleApplication2">
<key-property name="Id" column="StepId"/>
<key-property name="TId" column="TaskId"/>
</composite-id>

<version name="_version" column="GuidStamp" type="Int16" access="field" unsaved-value="0" generated="never"/>

<property name="Description" column="StepDesc" type="String" length="150"/>
<many-to-one name="Task" class="ConsoleApplication2.DAO.Task, ConsoleApplication2" column="TaskId"/>

<set name="Activities" cascade="all" lazy="true">
<key>
<column name="StepId"/>
<column name="TaskId"/>
</key>
<one-to-many class="ConsoleApplication2.DAO.Activity, ConsoleApplication2"/>
</set>
</class>
</hibernate-mapping>

and the exception raises at:

protected int Dehydrate(object id, object[] fields, object rowId, bool[] includeProperty, bool[][] includeColumns, int table,
IDbCommand statement, ISessionImplementor session, int index)

it seems that's miscounting the params, because:

1) sql: "INSERT INTO DBO.TE_STEP (GuidStamp, StepDesc, StepId, TaskId) VALUES (:p0, :p1, :p2, :p3)"
2) assignation of PKs (with index badly set at 3)
.
.
.
else if (id != null)
{
IdentifierType.NullSafeSet(statement, id, index, session); <---- FAILS HERE!!!
index += IdentifierColumnSpan;
}

and then try to set the compositeid at 3 and 4 (error!!)

Any help/suggestions with this???

Thanks
Mauro


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.