[hibernate-dev] Problem with setting boolean parameter

Steve Ebersole steve at hibernate.org
Mon Dec 17 10:00:59 EST 2012


Just to make sure I understand...

You have a domain attribute that is boolean, but you want to treat it as 
a number?

I.e.:
@Entity class Listing {
    ...
    boolean active;
}

Query q = session.createQuery( "from Listing l where listing.active = 
:isActive" );
q.setParameter(  "isActive", 1 );

rather than:
q.setParameter(  "isActive", true );

?

On 12/17/2012 07:34 AM, Oto Júnior wrote:
> Hi,
>
> I used Hibernate 2 in my software and now I'm using Hibernate 4.
> Before the version migration, the method Query.setParameter(p, 1) -
> [Integer values in boolean properties] - works well for setting
> boolean properties.
>
> Now, in Hibernate 4, doesn't work anymore.
> Anyone could help me?
>
>
> _______________________________________________________
> Oto Soares Coelho Júnior
> otojunior at gmail.com / otojr at dcc.ufmg.br
> Departamento de Ciência da Computação - UFMG
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev



More information about the hibernate-dev mailing list