# What is equivalent for type annotation in hibernate?

**URL:** https://discourse.hibernate.org/t/what-is-equivalent-for-type-annotation-in-hibernate/6152
**Category:** Hibernate ORM
**Created:** [March 16, 2022, 7:06am UTC](https://discourse.hibernate.org/t/what-is-equivalent-for-type-annotation-in-hibernate/6152 "2022-03-16T07:06:37Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Prashant\_Kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Prashant\_Kamble](https://discourse.hibernate.org/u/Prashant_Kamble)
#### Post date: [March 16, 2022, 7:06am UTC](https://discourse.hibernate.org/t/what-is-equivalent-for-type-annotation-in-hibernate/6152/1 "2022-03-16T07:06:37Z")

</div>

I have below code added while using hibernate search 5 .  
Now in hibernate search `org.hibernate.annotations.Type' is deprecated`

```auto
    @Id
    @Column(name = Team.ID_COL, length = 36)
    @Type(type = "uuid-char")
    @ApiModelProperty(hidden = true)
    private UUID teamId;

```

What would be the equivalent for type annotation in hibernate search 6?? In my case what is the replacement for `@Type(type = "uuid-char")` ?

---

<div class="post-metadata">

### Author: ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)
#### Post date: [March 16, 2022, 7:38am UTC](https://discourse.hibernate.org/t/what-is-equivalent-for-type-annotation-in-hibernate/6152/2 "2022-03-16T07:38:32Z")

</div>

This is not a Hibernate Search annotation, but a Hibernate ORM annotation.

Moving this topic to the appropriate category.

---

<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 16, 2022, 8:43am UTC](https://discourse.hibernate.org/t/what-is-equivalent-for-type-annotation-in-hibernate/6152/3 "2022-03-16T08:43:32Z")

</div>

The replacement in Hibernate ORM 6 is to use the `@JdbcTypeCode` annotation:

```java
    @Id
    @Column(name = Team.ID_COL)
    @JdbcTypeCode(java.sql.Types.VARCHAR)
    @ApiModelProperty(hidden = true)
    private UUID teamId;

```

---

<div class="post-metadata">

### Author: ![Prashant\_Kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Prashant\_Kamble](https://discourse.hibernate.org/u/Prashant_Kamble)
#### Post date: [March 16, 2022, 9:19am UTC](https://discourse.hibernate.org/t/what-is-equivalent-for-type-annotation-in-hibernate/6152/4 "2022-03-16T09:19:05Z")

</div>

Hi @beikov - I am using `hibernate 5.6.0.Final` jar in our project and we don’t see this `@JdbcTypeCode` annotation there

---

<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 16, 2022, 9:32am UTC](https://discourse.hibernate.org/t/what-is-equivalent-for-type-annotation-in-hibernate/6152/5 "2022-03-16T09:32:18Z")

</div>

So why are you asking for the replacement in Hibernate 6 then? You should update to 5.6.6.Final which will un-deprecate the `@Type` annotation. In 6.0 the annotation was changed to only accept `UserType` class literals.

---

<div class="post-metadata">

### Author: ![Prashant\_Kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Prashant\_Kamble](https://discourse.hibernate.org/u/Prashant_Kamble)
#### Post date: [March 16, 2022, 9:36am UTC](https://discourse.hibernate.org/t/what-is-equivalent-for-type-annotation-in-hibernate/6152/6 "2022-03-16T09:36:14Z")

</div>

Apology for inconvenience. This question was originally created for hibernate search 6 . Thanks

---

<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 16, 2022, 9:48am UTC](https://discourse.hibernate.org/t/what-is-equivalent-for-type-annotation-in-hibernate/6152/7 "2022-03-16T09:48:55Z")

</div>

Not sure what this question has to do with Hibernate Search 6 since this is an annotation from Hibernate ORM, but like I wrote, the deprecation was removed in newer versions of Hibernate ORM 5.6

---

<div class="post-metadata">

### Author: ![Prashant\_Kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Prashant\_Kamble](https://discourse.hibernate.org/u/Prashant_Kamble)
#### Post date: [March 16, 2022, 9:54am UTC](https://discourse.hibernate.org/t/what-is-equivalent-for-type-annotation-in-hibernate/6152/8 "2022-03-16T09:54:32Z")

</div>

Sorry It was my confusion . Initially I though this annotation is from Hibernate Search 6.  
After upgrading to 5.6.6 type annotation got un-deprecated. I hope with 5.6.6 there should not be any impact on hibernate search 6.0
