-->
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.  [ 4 posts ] 
Author Message
 Post subject: Boolean mapping CGLIB error
PostPosted: Tue Apr 11, 2006 1:33 pm 
Newbie

Joined: Tue Apr 11, 2006 12:16 pm
Posts: 2
Hi all.
I’m trying to map a POJO in hibernate and everything works fine. One of the mapped attributes is a boolean. It works.
The problem starts when I add another boolean field. When I update the xxx.hbm.xml and re-launch the application I get this error message:

Quote:
org.springframework.orm.hibernate3.HibernateSystemException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of contactos.negocio.Contacto.setContactado; nested exception is org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of contactos.negocio.Contacto.setContactado


The model object setter exists and is correct, the database table is also correct.
This error has no sense to me. Why works for first one, and not for the other? I have read the code a lot of times and I can’t understand this error.

Here is the code:

Mapping file: contacto.hbm.xml:
Code:

<property name="afiliado" type="boolean" />  <!-- works ->
<property name="contactado" type="boolean" /> <!-- fails ->



Model object: contactos.negocio.Contacto

Code:


private boolean afiliado;
private boolean contactado;

    public boolean isAfiliado() {
        return afiliado;
    }

public boolean isContactado() {
        return contactado;
    }

public void setAfiliado(boolean afiliado) {
        this.afiliado = afiliado;
    }

public void setContactado(boolean contactado) {
        this.contactado = contactado;
    }
…   


Any idea of what is wrong?
Thanks in advance

Extra info:
INFO - CGLIB2 available: proxyTargetClass feature enabled
INFO - Hibernate 3.1.2

INFO - using CGLIB reflection optimizer
INFO - RDBMS: PostgreSQL, version: 7.4.8
INFO - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 7.4 JDBC3 with SSL (build 210)
INFO - Using dialect: org.hibernate.dialect.PostgreSQLDialect


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 11, 2006 2:04 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Probably "contactado" is null, see root cause.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 20, 2006 5:43 pm 
Regular
Regular

Joined: Sat Jan 07, 2006 8:30 pm
Posts: 68
Don't you think that in such cases we should have a default conversion ?
null -> false


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 21, 2006 3:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
should not be the default because null != false

if you want an appspecific default use and UserType

_________________
Max
Don't forget to rate


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