-->
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.  [ 7 posts ] 
Author Message
 Post subject: BulkBeanException ...
PostPosted: Thu Nov 25, 2004 11:10 am 
Beginner
Beginner

Joined: Tue Sep 21, 2004 1:49 pm
Posts: 33
Location: Bogota, Colombia
Hi, I need to store the values in some Strings as uppercase, I dont know if hibernate has some feature for that.. what I tried, for simpleness (not touching the interface or the DAOs, was in my POJO, on the set method, I assigned the value as uppercase to my property:

Code:
public void setProp(String prop) {
   this.prop = prop.toUppercase();
}


The mapping file is as follows:

Code:
        <property
            name="prop"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="PROP"
            length="1"
        />


Hibernate version:2.1.7c

Full stack trace of any exception that occurs:

Code:
2004-11-25 10:06:12,703 INFO  [net.sf.hibernate.util.ReflectHelper] reflection optimizer disabled for: package.AClass, BulkBeanException: null (property setProp)


If I remove the ".toUpperCase()" it works fine.. any ideas? thanks!

PD. Im using jboss 3.2.6 and the cglib-2.0.2.jar included in the hibernate 2.1.7c zip.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 25, 2004 1:00 pm 
Regular
Regular

Joined: Tue Oct 26, 2004 3:54 pm
Posts: 60
You must check that the string prop isn't null.

The reflection optimizer will try to use the set method with a null value, and if it fails it'll throw a BulkBeanException. At least, that's what I think... ;)

Change to :

Code:
public void setProp(String prop) {
   this.prop = prop != null ? prop.toUppercase() : null;
}


Giulio Vezzelli


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 25, 2004 1:35 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You know that "reflection optimizer disabled" is just a info message? Ignore it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 25, 2004 1:39 pm 
Regular
Regular

Joined: Tue Oct 26, 2004 3:54 pm
Posts: 60
And what does *actually* mean that reflection optimizer is disabled for a certain class ?

Shouldn't I care of it even if it just costs me to check that I don't do funky stuff with null values ?

Giulio Vezzelli


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 25, 2004 1:47 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well it just means plain old reflection is used instead of cglib-optimized reflection.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 25, 2004 1:53 pm 
Regular
Regular

Joined: Tue Oct 26, 2004 3:54 pm
Posts: 60
Ok.

Since reflection optimizer is a good thing (java plain old reflection didn't shine for performance, if I remember well), it's correct that Hibernate *warns* (non blocking error) about not using it, and it's correct for me to try to make Hibernate use it.

Since anyway BulkBeanException means that one of your setters is not checking for doing operations on a null parameter... it's better not to have any BulkBeanException!

Of course that's only my opinion.


Giulio Vezzelli


Top
 Profile  
 
 Post subject: effectively.
PostPosted: Fri Nov 26, 2004 10:52 am 
Beginner
Beginner

Joined: Tue Sep 21, 2004 1:49 pm
Posts: 33
Location: Bogota, Colombia
You guys know a lot, that was it. Thanks giulio, thanks michael. :)


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