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