-->
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.  [ 6 posts ] 
Author Message
 Post subject: exception setting property value with CGLIB
PostPosted: Fri Apr 21, 2006 8:03 pm 
Newbie

Joined: Fri Apr 21, 2006 7:41 pm
Posts: 4
Hi Guru,

I use hibernate 3.1.3, I got the following error.

The following exception was logged org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.unicsolutions.drp.domain.EmployeeInfos.setIswarrant

map file

<property name="iswarrant"
type="character"
column="iswarrant"
/>

Table (DB2/UDB v8.2)

iswarrant char 1

class

private String iswarrant;

some fields before this fields are OK in the class because Hibernate didn't complain them.

I appreciate it if someone could help me.

Thanks in advance !

xm


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 22, 2006 7:36 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 3:44 am
Posts: 32
change as following

<property name="iswarrant"
type="character"
column="iswarrant" type="char"
/>

in corresponding Java Bean, change the type of variable to char....it shall work

sudhir


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 23, 2006 8:02 am 
Newbie

Joined: Fri Apr 21, 2006 7:41 pm
Posts: 4
You can not use 2 types in <property> tag. it didn't work.

Thansk,

XM


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 23, 2006 5:21 pm 
Senior
Senior

Joined: Tue Mar 09, 2004 2:38 pm
Posts: 141
Location: Lowell, MA USA
What I think he meant to say XM was in your code, change the property type in Java from String to either a char primitive or Character object:

Code:
<property
name="iswarrant"
type="character"
column="iswarrant"
/>



Code:
class

private char iswarrant;


You cannot map a char value to a string. However, if your code demands that this value be a String, you can change your mapping to:

Code:
<property
name="iswarrant"
type="string"
column="iswarrant"
/>


This is totally valid and will work just fine. I have production code that does exactly this. Generally, you'd be better off using a char value if the database vaule only accepts a single character.

Ryan-

_________________
Ryan J. McDonough
http://damnhandy.com

Please remember to rate!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 8:08 am 
Newbie

Joined: Fri Apr 21, 2006 7:41 pm
Posts: 4
I use websphere 6/Hibernate 3.1.3/UDB 8.2, and I did try the following setting, but it didn't work.

<property
name="iswarrant"
type="character"
column="iswarrant"
/>


class

private char iswarrant;


Table
iswarrant char 1

if I use createSQLQuery() to retrieve data into the object, it looks fine, now I use the following setting temporaly, it works.

<property
name="iswarrant"
type="string"
column="iswarrant"
/>


class

private String iswarrant;


Table (DB2/UDB v8.2)

iswarrant varchar 1


Thanks,

xm


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 11:36 am 
Senior
Senior

Joined: Tue Mar 09, 2004 2:38 pm
Posts: 141
Location: Lowell, MA USA
Don't forget to rate! :)

Ryan-

_________________
Ryan J. McDonough
http://damnhandy.com

Please remember to rate!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.