-->
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: org.springframework.orm.hibernate3.HibernateSystemException:
PostPosted: Wed Feb 13, 2008 12:04 am 
Newbie

Joined: Thu Nov 29, 2007 5:11 am
Posts: 2
Location: Jakarta
Hi all,

I got the error when access the database using hibernate.
please give me an aid. I think the error are from the wrong configuration of <many-to-one on that .hbm.xml

this is my SystemParameterDetail.hbm.xml :

Code:
<?xml version="1.0" encoding="UTF-8"?>

<!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.praweda.rtgs.domain.SystemParameterDetail"
        table="T_SYSPARMD"
    >

        <composite-id
            name="id"
            class="com.praweda.rtgs.domain.SystemParameterDetailPK"
            unsaved-value="any"
        >
                     <key-property
                        name="memberCode"
                        type="java.lang.String"
                        column="MEMCDE"
                        length="17"
                />

                     <key-property
                        name="name"
                        type="java.lang.String"
                        column="SPNAME"
                        length="30"
                />

        </composite-id>

        <property
            name="value"
            type="java.lang.String"
            update="true"
            insert="true"
            column="SPVALUE"
            length="30"
            not-null="true"
        />

        <many-to-one
            name="systemParameterHeader"
            class="com.praweda.rtgs.domain.SystemParameterHeader"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            column="SPNAME"
        />

        <property
            name="dateStamp"
            type="java.util.Date"
            update="true"
            insert="true"
            column="DTSTAMP"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-SystemParameterDetail.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>



this is my systemParamaeterDetailHeader.hbm.xml :

Code:
<?xml version="1.0" encoding="UTF-8"?>

<!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.praweda.rtgs.domain.SystemParameterHeader"
        table="T_SYSPARMH"
    >

        <id
            name="name"
            column="SPNAME"
            type="java.lang.String"
            length="30"
        >
       
         <!--
          <generator class="">
           
                  To add non XDoclet generator parameters, create a file named
                  hibernate-generator-params-SystemParameterHeader.xml
                  containing the additional parameters and place it in your merge dir.
           
          </generator>
         -->   
        </id>

        <property
            name="clazz"
            type="java.lang.String"
            update="true"
            insert="true"
            column="CLAZZ"
            length="30"
        />

        <property
            name="format"
            type="java.lang.String"
            update="true"
            insert="true"
            column="FORMAT"
            length="30"
        />

        <property
            name="defaultValue"
            type="java.lang.String"
            update="true"
            insert="true"
            column="SPDEFAULT"
            length="30"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-SystemParameterHeader.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>



when I access the page that need two of them, appears the error like this :

Quote:
10:49:05,140 ERROR [DispatchAction] Provided id of the wrong type. Expected: class java.lang.String, got class [Ljava.lang.String;; nested exception is org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.String, got class [Ljava.lang.String;
org.springframework.orm.hibernate3.HibernateSystemException: Provided id of the wrong type. Expected: class java.lang.String, got class [Ljava.lang.String;; nested exception is org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.String, got class [Ljava.lang.String;
Caused by:
org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.String, got class [Ljava.lang.String;
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:86)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at com.praweda.rtgs.dao.hibernate.AbstractDao.getObjectById(AbstractDao.java:23)
at com.praweda.rtgs.dao.hibernate.SystemParameterDaoImpl.getSystemParameterHeader(SystemParameterDaoImpl.java:34)
at com.praweda.rtgs.dao.hibernate.SystemParameterDaoImpl.getSystemParameterDetail(SystemParameterDaoImpl.java:62)
at com.praweda.rtgs.logic.TransactionImpl.processTransmitData(TransactionImpl.java:599)
....



hope you could help me!

thx
Regards,

Kahlil

_________________
<!-- Give up is not a choice -->


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.