# How to define @Type annotation on orm.xml

**URL:** https://discourse.hibernate.org/t/how-to-define-type-annotation-on-orm-xml/8954
**Category:** Hibernate ORM
**Created:** [February 1, 2024, 7:50pm UTC](https://discourse.hibernate.org/t/how-to-define-type-annotation-on-orm-xml/8954 "2024-02-01T19:50:48Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![meneghette](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/meneghette/32/2988_2.png) [@meneghette](https://discourse.hibernate.org/u/meneghette)
#### Post date: [February 1, 2024, 7:50pm UTC](https://discourse.hibernate.org/t/how-to-define-type-annotation-on-orm-xml/8954/1 "2024-02-01T19:50:48Z")

</div>

HOw can I ovverride the @Type annotation on orm.xml?

FOr example I Would like to set at orm.xml the @Type(JsonType.class)

Because in some database this will change

---

<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: [February 2, 2024, 10:45am UTC](https://discourse.hibernate.org/t/how-to-define-type-annotation-on-orm-xml/8954/2 "2024-02-02T10:45:07Z")

</div>

Why would you want to do that? Hibernate ORM 6 comes with JSON support out of the box and uses the best matching underlying SQL type. Just annotate your attribute with `@JdbcTypeCode(SqlTypes.JSON)`.

---

<div class="post-metadata">

### Author: ![meneghette](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/meneghette/32/2988_2.png) [@meneghette](https://discourse.hibernate.org/u/meneghette)
#### Post date: [February 2, 2024, 11:21am UTC](https://discourse.hibernate.org/t/how-to-define-type-annotation-on-orm-xml/8954/3 "2024-02-02T11:21:15Z")

</div>

Hi @beikov , tks for your reply

Because Oracle 19c do not support Json Column,

I Used a blob column to store the json, for that I use the annotation  
Type(JsonType.class) of io.hypersistence.utils.hibernate.type.json.JsonType

With Column(columnDefinition = “BLOB CONSTRAINT JSON\_WRFLDEF\_WRFL CHECK (WORKFLOW IS JSON)”)

But I have another database Oracle 21, that supports Json Column

This JdbcTypeCode(SqlTypes.JSON) Will work with blob column with json content too?

If not I need to set on orm.xml for oracle 19c the type io.hypersistence.utils.hibernate.type.json.JsonType, and column definition

---

<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: [February 5, 2024, 10:17am UTC](https://discourse.hibernate.org/t/how-to-define-type-annotation-on-orm-xml/8954/4 "2024-02-05T10:17:43Z")

</div>

Hibernate ORM will use the blob type automatically, you can just annotate `@JdbcTypeCode(SqlTypes.JSON)`.

---

<div class="post-metadata">

### Author: ![meneghette](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/meneghette/32/2988_2.png) [@meneghette](https://discourse.hibernate.org/u/meneghette)
#### Post date: [February 5, 2024, 5:07pm UTC](https://discourse.hibernate.org/t/how-to-define-type-annotation-on-orm-xml/8954/5 "2024-02-05T17:07:44Z")

</div>

Perfect, It Worked very well

Thank you very much

ON more question, is possible to override on orm.xml the @type annotation if needed? I search , and I do not find

---

<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: [February 6, 2024, 9:51am UTC](https://discourse.hibernate.org/t/how-to-define-type-annotation-on-orm-xml/8954/6 "2024-02-06T09:51:43Z")

</div>

You can use Hibernates mapping XSD, which is a drop-in replacement for the JPA orm.xml XSD, but comes with extensions: [https://hibernate.org/xsd/orm/mapping/mapping-3.1.0.xsd](https://hibernate.org/xsd/orm/mapping/mapping-3.1.0.xsd)
