# Got error in array function "array\_contains()"

**URL:** <https://discourse.hibernate.org/t/got-error-in-array-function-array-contains/9176>\
**Category:** Hibernate ORM\
**Created:** [March 12, 2024, 9:26am UTC](https://discourse.hibernate.org/t/got-error-in-array-function-array-contains/9176 "2024-03-12T09:26:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aref\_n](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@aref\_n](https://discourse.hibernate.org/u/aref_n)\
**Post date:** [March 12, 2024, 9:26am UTC](https://discourse.hibernate.org/t/got-error-in-array-function-array-contains/9176/1 "2024-03-12T09:26:31Z")

</div>

Hi  
I wanna use the array\_contains() function to search a value in my array field in entity  
the type of filed is Float  
but I got this error  
Parameter 0 of function ‘array\_contains()’ requires an array type, but argument is of type ‘float’  
Any idea about this error?  
what type of array should be use?

---

<div class="post-metadata">

**Author:** ![mbladel](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mbladel/32/2128_2.png) [@mbladel](https://discourse.hibernate.org/u/mbladel)\
**Post date:** [March 12, 2024, 10:31am UTC](https://discourse.hibernate.org/t/got-error-in-array-function-array-contains/9176/2 "2024-03-12T10:31:46Z")

</div>

Hi, what version of Hibernate are you using? Official support for array functions including `array_contains()`, was introduced in [Hibernate 6.4](https://in.relation.to/2023/10/26/orm-64cr1/). Could you also share the mapping of the entity containing the `Float[]` field please?

---

<div class="post-metadata">

**Author:** ![aref\_n](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@aref\_n](https://discourse.hibernate.org/u/aref_n)\
**Post date:** [March 12, 2024, 11:16am UTC](https://discourse.hibernate.org/t/got-error-in-array-function-array-contains/9176/3 "2024-03-12T11:16:01Z")

</div>

I use 6.4  
And for mapping I use hypersistence utils and `FloatArrayType`  
This is my code for this field

```auto

    @Type(FloatArrayType.class)
    @Column(
        name = "sample_array",
        columnDefinition = "float4[]"
    )
    private Float[] sampleArray;

```

---

<div class="post-metadata">

**Author:** ![mbladel](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mbladel/32/2128_2.png) [@mbladel](https://discourse.hibernate.org/u/mbladel)\
**Post date:** [March 12, 2024, 11:17am UTC](https://discourse.hibernate.org/t/got-error-in-array-function-array-contains/9176/4 "2024-03-12T11:17:22Z")

</div>

There’s no need to use a custom `@Type` since Hibernate now natively supports arrays. Please remove that annotation (and maybe even the `columnDefinition`) and let us know if that works.

---

<div class="post-metadata">

**Author:** ![aref\_n](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@aref\_n](https://discourse.hibernate.org/u/aref_n)\
**Post date:** [March 12, 2024, 1:18pm UTC](https://discourse.hibernate.org/t/got-error-in-array-function-array-contains/9176/5 "2024-03-12T13:18:29Z")

</div>

Yeah it work but problem is here I wanna wrapper class not primitive data

---

<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:** [March 13, 2024, 1:51pm UTC](https://discourse.hibernate.org/t/got-error-in-array-function-array-contains/9176/6 "2024-03-13T13:51:26Z")

</div>

Just remove the `@Type` annotation and Hibernate ORM will work fine. There is no need to use Hypersistence for arrays with ORM 6.1+
