# Operand of \* is of type 'java.lang.Boolean' which is not a numeric type

**URL:** <https://discourse.hibernate.org/t/operand-of-is-of-type-java-lang-boolean-which-is-not-a-numeric-type/9789>\
**Category:** Hibernate ORM\
**Created:** [June 23, 2024, 1:13pm UTC](https://discourse.hibernate.org/t/operand-of-is-of-type-java-lang-boolean-which-is-not-a-numeric-type/9789 "2024-06-23T13:13:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![trueMiskin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/truemiskin/32/2284_2.png) [@trueMiskin](https://discourse.hibernate.org/u/trueMiskin)\
**Post date:** [June 23, 2024, 1:13pm UTC](https://discourse.hibernate.org/t/operand-of-is-of-type-java-lang-boolean-which-is-not-a-numeric-type/9789/1 "2024-06-23T13:13:41Z")

</div>

Hi,

we use in some queries the boolean values as integer/double values but now it throws `Operand of * is of type 'java.lang.Boolean' which is not a numeric type`. How should we resolve it? I think it is quite normal to use the boolean as 0/1 values.

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [July 3, 2024, 12:37pm UTC](https://discourse.hibernate.org/t/operand-of-is-of-type-java-lang-boolean-which-is-not-a-numeric-type/9789/2 "2024-07-03T12:37:03Z")

</div>

This is not normal at all. You should use a `case` expression to produce the desired result instead e.g. `case when entity.booleanAttribute then 1 else 0 end`

---

<div class="post-metadata">

**Author:** ![trueMiskin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/truemiskin/32/2284_2.png) [@trueMiskin](https://discourse.hibernate.org/u/trueMiskin)\
**Post date:** [July 10, 2024, 3:15pm UTC](https://discourse.hibernate.org/t/operand-of-is-of-type-java-lang-boolean-which-is-not-a-numeric-type/9789/3 "2024-07-10T15:15:58Z")

</div>

Recasting the column as an integer works for me.  
I think in this case it should work same like the case expression.

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [July 11, 2024, 10:18am UTC](https://discourse.hibernate.org/t/operand-of-is-of-type-java-lang-boolean-which-is-not-a-numeric-type/9789/4 "2024-07-11T10:18:14Z")

</div>

Strict typing is there to prevent user errors. Maybe you mistyped your query with such implicit conversions, you’re going to potentially miss out on your error.

Just use casting or a case expression please. That will also make it clearer for readers.
