[hibernate-dev] Custom SQL update problem

Anatoli Atanasov anatoli at atanasov.name
Fri May 9 17:19:14 EDT 2008


Dear Experts,

I have an issue with the Hibernate custom sql commands. I have the mapping
file:

*<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
    <class name="com.gsk.europepharma.clinfit.model.entities.InputFile"
table="INPUT_FILE" schema="CLINFIT">
        <id name="id">
            <column name="ID" sql-type="number" length="10" precision="0"
not-null="true"/>
            <generator class="sequence">
                <param name="sequence">S_INPUT_FILE</param>
            </generator>
        </id>
        <property name="fileType">
            <column name="FILE_TYPE" sql-type="varchar2" length="20"
precision="0" not-null="true"/>
        </property>
        <property name="forDate">
            <column name="FOR_DATE" sql-type="date" length="7" precision="0"
not-null="true"/>
        </property>
        <property name="statusCode">
            <column name="STATUS_CODE" sql-type="varchar2" length="20"
precision="0" not-null="true"/>
        </property>
        <property name="datetimeLastProcessed">
            <column name="DATETIME_LAST_PROCESSED" sql-type="date"
length="7" precision="0" not-null="false"/>
        </property>
        <property name="datetimeStatusLastChanged">
            <column name="DATETIME_STATUS_LAST_CHANGED" sql-type="date"
length="7" precision="0" not-null="true"/>
        </property>
        <property name="invalidDataMessage">
            <column name="INVALID_DATA_MESSAGE" sql-type="varchar2"
length="1000" precision="0" not-null="false"/>
        </property>
        <many-to-one name="country"
class="com.gsk.europepharma.clinfit.model.entities.CCountry">
            <column name="COUNTRY_ID" not-null="true"/>
        </many-to-one>
        <!-- TODO: comment it -->
        <sql-update callable="true">{ ? = call
BUSINESS_LOGIC_PKG.CHANGE_INPUT_FILE_STATUS (?, ?, ?, ?, ?, ?, ?,
?)}</sql-update>
    </class>
</hibernate-mapping>*

When my objects at runtime are updated I am getting  the following
Exception:
*Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 9
    at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at
oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1729)
    at
oracle.jdbc.driver.OraclePreparedStatement.addBatch(OraclePreparedStatement.java:10547)
    at
oracle.jdbc.driver.OracleCallableStatement.addBatch(OracleCallableStatement.java:2009)
    at
org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:31)
    at
org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2408)
    ... 25 more

*The update function - *BUSINESS_LOGIC_PKG.CHANGE_INPUT_FILE_STATUS *is
implemented in Oracle 10g R2. Before this I checked the order of parameters
with debuging the static queries. I went through the code and I could not
find any where registerOutputParameter invocation to the callable statement,
so the result can be consumed back to Hibernate.

Can anybody help me!

Thanks in advance!

Best regards,
Anatoli

-- 
Anatoli Atanasov
mobile: (+359) 888 32 06 49



-- 
Anatoli Atanasov
mobile: (+359) 888 32 06 49
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20080510/9c6cb3a9/attachment.html 


More information about the hibernate-dev mailing list