[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-1094) ClassCastException on session.get or session.load with BigInteger as primary key
Steve Ebersole (JIRA)
noreply at atlassian.com
Mon Mar 21 13:00:43 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Ebersole closed HHH-1094.
-------------------------------
Closing stale resolved issues
> ClassCastException on session.get or session.load with BigInteger as primary key
> --------------------------------------------------------------------------------
>
> Key: HHH-1094
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1094
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc2
> Environment: Tomcat 5.5.4 on Windows XP Professional
> Oracle 9.2.0.6.0 64bit on Solaris
> Java 1.5.0_05
> Hibernate 3.1rc2
> Reporter: Dirk Weigenand
>
> The following code
> public static Produkt findProduktById( String produktId ) {
> Session session = HibernateUtil.currentSession();
> log.info( "produktId: " + produktId );
> Produkt produkt = (Produkt)session.get( Produkt.class, new BigInteger( produktId ) );
> HibernateUtil.closeSession();
>
> return produkt;
> }
> yields following exeption when executed:
> java.lang.ClassCastException: java.math.BigInteger
> org.hibernate.type.BigDecimalType.getHashCode(BigDecimalType.java:48)
> org.hibernate.type.AbstractType.getHashCode(AbstractType.java:120)
> org.hibernate.engine.EntityKey.getHashCode(EntityKey.java:68)
> org.hibernate.engine.EntityKey.<init>(EntityKey.java:41)
> org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:76)
> org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:809)
> org.hibernate.impl.SessionImpl.get(SessionImpl.java:749)
> org.hibernate.impl.SessionImpl.get(SessionImpl.java:742)
> de.gisa.orderit.beans.ProduktFinder.findProduktById(ProduktFinder.java:71)
> The class is mapped as follows:
> <class name="de.gisa.orderit.beans.Produkt" table="ORD_PRODUKTE" schema="ORDERITT">
> <id name="idProdPk" type="big_decimal">
> <column name="ID_PROD_PK" precision="22" scale="0" />
> <generator class="assigned" />
> </id>
> <many-to-one name="Produktkategorien" class="de.gisa.orderit.beans.Produktkategorie" fetch="select">
> <column name="ID_KAT_FK" precision="22" scale="0" not-null="true" />
> </many-to-one>
> <many-to-one name="Formular" class="de.gisa.orderit.beans.Formular" fetch="select">
> <column name="ID_FRM_FK" precision="22" scale="0" />
> </many-to-one>
> <many-to-one name="Mandant" class="de.gisa.orderit.beans.Mandant" fetch="select">
> <column name="ID_MDT_FK" precision="22" scale="0" not-null="true" />
> </many-to-one>
> <many-to-one name="User" class="de.gisa.orderit.beans.User" fetch="select">
> <column name="ID_USER_AV_FK" precision="22" scale="0" not-null="true" />
> </many-to-one>
> <many-to-one name="Produkttyp" class="de.gisa.orderit.beans.Produkttyp" fetch="select">
> <column name="ID_PTY_FK" precision="22" scale="0" not-null="true" />
> </many-to-one>
> <property name="name" type="string">
> <column name="NAME" length="100" not-null="true" />
> </property>
> <property name="beschreibung" type="string">
> <column name="BESCHREIBUNG" length="1000" />
> </property>
> <property name="plb" type="string">
> <column name="PLB" length="10" />
> </property>
> <property name="prodAktiv" type="character">
> <column name="PROD_AKTIV" length="1" not-null="true" />
> </property>
> <set name="Bestellungs" inverse="true">
> <key>
> <column name="ID_PROD_FK" precision="22" scale="0" not-null="true" />
> </key>
> <one-to-many class="de.gisa.orderit.beans.Bestellung" />
> </set>
> </class>
> Thanks.
> Dirk
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list