-->
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.  [ 3 posts ] 
Author Message
 Post subject: ClassCastException setting property value with CGL
PostPosted: Mon Nov 10, 2003 5:00 am 
Newbie

Joined: Tue Oct 28, 2003 8:00 am
Posts: 16
Location: Karlsruhe, Germany
hi,

I get the following exception with hibernate 2.0:

ClassCastException
exception setting property value with CGLIB
setter of com.cpusoftwarelab.c6.app.vo.LebenshaltungskostentabelleVO.?

I tried to isolate the problem and reduced my code but the exception
remains. Can someone help me ?


I use a CompositeUserType com.cpusoftwarelab.c6.app.vo.C6Betrag and
this works in some other classes (see AuszahlungVO), but in
my class com.cpusoftwarelab.c6.app.vo.LebenshaltungskostentabelleVO
I can create an persistent entry in the database but get
the mentioned exception every time I load the saved entry
with his key.

This is our mapping from class LebenshaltungskostentabelleVO and
from LebenshaltungskostenVO, which contains a list from LebenshaltungskostentabelleVO.


<hibernate-mapping>
<class
name="com.cpusoftwarelab.c6.app.vo.LebenshaltungskostentabelleVO"
table="LHKTABELLE"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="VOID"
type="string"
length="32"
unsaved-value="null"
>
<generator class="uuid.hex">
</generator>
</id>

<timestamp
name="aenderungszeitpunkt"
column="TIME_MODIFIED"
/>

<property
name="betrag"
type="com.cpusoftwarelab.c6.app.vo.C6Betrag"
update="true"
insert="true"
>
<column
name="BTR"
/>
<column
name="BTRWHG"
length="3"
/>
</property>

<property
name="erstellungszeitpunkt"
type="timestamp"
update="true"
insert="true"
column="TIME_CREATED"
/>

<property
name="geaendertVon"
type="java.lang.String"
update="true"
insert="true"
column="MODIFIED_BY"
/>
</class>

</hibernate-mapping>


<hibernate-mapping>
<class
name="com.cpusoftwarelab.c6.app.vo.LebenshaltungskostenVO"
table="LEBENSHALTUNGSKOSTEN"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="VOID"
type="string"
length="32"
unsaved-value="null"
>
<generator class="uuid.hex">
</generator>
</id>

<timestamp
name="aenderungszeitpunkt"
column="TIME_MODIFIED"
/>

<list
name="tabelle"
lazy="false"
inverse="false"
cascade="all"
>

<key
column="LHK_ID"
/>

<index
column="LHKTAB_ID"
type="integer"
/>
<one-to-many
class="com.cpusoftwarelab.c6.app.vo.LebenshaltungskostentabelleVO"
/>
</list>

</class>

</hibernate-mapping>

this is the create SQL for the table:

create table LHKTABELLE (
VOID VARCHAR2(32) not null,
TIME_MODIFIED DATE not null,
BTR DOUBLE PRECISION,
BTRWHG VARCHAR2(3),
TIME_CREATED DATE,
MODIFIED_BY VARCHAR2(255),
LHK_ID VARCHAR2(32),
LHKTAB_ID NUMBER(10,0),
primary key (VOID)
);


this is the mapping form the working example AuszahlungVO:

<hibernate-mapping>
<class
name="com.cpusoftwarelab.c6.app.vo.AuszahlungVO"
table="AUSZAHLUNG"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="VOID"
type="string"
length="32"
unsaved-value="null"
>
<generator class="uuid.hex">
</generator>
</id>

<timestamp
name="aenderungszeitpunkt"
column="TIME_MODIFIED"
/>

<property
name="betrag"
type="com.cpusoftwarelab.c6.app.vo.C6Betrag"
update="true"
insert="true"
>
<column
name="BETRAG"
/>
<column
name="WHG"
length="3"
/>
</property>

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

<property
name="blz"
type="string"
update="true"
insert="true"
column="BLZ"
length="8"
/>

<property
name="empfaenger"
type="string"
update="true"
insert="true"
column="EMPFAENGER"
length="30"
/>

<property
name="kontonummer"
type="string"
update="true"
insert="true"
column="KTONR"
length="36"
/>

<property
name="zweck"
type="string"
update="true"
insert="true"
column="ZWECK"
length="150"
/>

<property
name="erstellungszeitpunkt"
type="timestamp"
update="true"
insert="true"
column="TIME_CREATED"
/>

<property
name="geaendertVon"
type="java.lang.String"
update="true"
insert="true"
column="MODIFIED_BY"
/>
</class>

</hibernate-mapping>

create table AUSZAHLUNG (
VOID VARCHAR2(32) not null,
TIME_MODIFIED DATE not null,
BETRAG DOUBLE PRECISION,
WHG VARCHAR2(3),
DATUM DATE,
BLZ VARCHAR2(8),
EMPFAENGER VARCHAR2(30),
KTONR VARCHAR2(36),
ZWECK VARCHAR2(150),
TIME_CREATED DATE,
MODIFIED_BY VARCHAR2(255),
LBAUST_ID VARCHAR2(32),
AUSZNR NUMBER(10,0),
primary key (VOID)
);


why do I get this exception ?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 7:24 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Try to set hibernate.cglib.use_reflection_optimizer to false in your config file.
Check getters and setters of LebenshaltungskostentabelleVO

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 8:16 am 
Newbie

Joined: Tue Oct 28, 2003 8:00 am
Posts: 16
Location: Karlsruhe, Germany
I think I have found the problem:

When I check for null of value in the nullSafeSet methode of my userType (C6Betrag.nullSafeSet) before I typecast to my userType I can save and load my entity.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.