Hello,

I'm encountering a persistent error. I'm trying to use a parameter map inside my application. Here goes:

<parameterMap id="studentMap" class="com.mafoi.bats.Student">
<parameter property="id"/>
<parameter property="name"/>
<parameter property="dob"/>
<parameter property="doe"/>
<parameter property="streamId"/>
<parameter property="batchId"/>
<parameter property="photo" javaType="com.mafoi.bats.Image" jdbcType="bytea"/>
</parameterMap>
<insert id="insertStudent" parameterMap="studentMap">
insert into students (id, name, dob, doe, stream_id, batch_id, photo)
values (#id#, #name#, to_date(#dob#, 'DD/MM/YYYY'),
to_date(#doe#, 'DD/MM/YYYY'), #streamId#, #batchId#, #photo#)
</insert>


This seems perfectly alright to me, but I'm getting this exception:

javax.servlet.ServletException: --- The error occurred in com/mafoi/bats/Student.xml. --- The error occurred while applying a parameter map. --- Check the studentMap. --- Check the parameter mapping for the 'id' property. --- Cause: org.postgresql.util.PSQLException: Parameter index out of range.
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
[...]


As you can see, I don't think there is anything wrong with the mapping. the "Student" class getter/setter or the "id" variable, and it is an int. I'm using a custom type handler for "photo" property. Can it be the problem? I'm lost. Please help.

TIA,
Vamsee.



Reply via email to