# What is replacement of getTypeName() in DIalect class of Hibernate

**URL:** <https://discourse.hibernate.org/t/what-is-replacement-of-gettypename-in-dialect-class-of-hibernate/10991>\
**Category:** Hibernate ORM\
**Created:** [February 5, 2025, 7:58am UTC](https://discourse.hibernate.org/t/what-is-replacement-of-gettypename-in-dialect-class-of-hibernate/10991 "2025-02-05T07:58:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjk22071998](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mjk22071998/32/3812_2.png) [@mjk22071998](https://discourse.hibernate.org/u/mjk22071998)\
**Post date:** [February 5, 2025, 7:58am UTC](https://discourse.hibernate.org/t/what-is-replacement-of-gettypename-in-dialect-class-of-hibernate/10991/1 "2025-02-05T07:58:24Z")

</div>

I have been tasked to upgrade a Java project, and now in the `Hibernate` package, there was a function `dialect.getTypeName()` but now it is giving me undefined after upgrading to `6.6.6` I don’t want to go back I need alternatives. below is my function call

```auto
dialect.getTypeName(-16, 255, 0, 0)

```

but I am getting error getTypeName is not defined. I have searched and have found that it has been moved to `Jdbc` but I could not found any way what will do the exact same thing the above code can

---

<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:** [February 5, 2025, 12:31pm UTC](https://discourse.hibernate.org/t/what-is-replacement-of-gettypename-in-dialect-class-of-hibernate/10991/2 "2025-02-05T12:31:48Z")

</div>

You should use `org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry#getTypeName(int, org.hibernate.engine.jdbc.Size, org.hibernate.type.Type)`.

---

<div class="post-metadata">

**Author:** ![mjk22071998](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mjk22071998/32/3812_2.png) [@mjk22071998](https://discourse.hibernate.org/u/mjk22071998)\
**Post date:** [February 6, 2025, 6:26am UTC](https://discourse.hibernate.org/t/what-is-replacement-of-gettypename-in-dialect-class-of-hibernate/10991/3 "2025-02-06T06:26:28Z")

</div>

Ok, thank you very much for your response kindly can you help me do this? I mean how to initialize `DdlTypeRegistry`, `Size` and `Type` and how to combine them all to get the type name? It will be a great help if I can get a simple code example. Note that in my code dialect is of type `Dialect` I actually made a generic class where user choses their database so it is of default parent class

---

<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:** [February 7, 2025, 8:27am UTC](https://discourse.hibernate.org/t/what-is-replacement-of-gettypename-in-dialect-class-of-hibernate/10991/4 "2025-02-07T08:27:49Z")

</div>

You can get the `DdlTypeRegistry` from `TypeConfiguration`, which you can get from several places e.g. `org.hibernate.engine.spi.SessionFactoryImplementor#getTypeConfiguration`. `Size` you should just instantiate yourself, and `Type` should be optional in most cases, otherwise you can get it from Hibernate’s `org.hibernate.mapping.Value#getType()`.

Alternatively, you can also use `org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry#getTypeName(int, org.hibernate.dialect.Dialect)` to get the type name from a `java.sql.Types` JDBC code.

---

<div class="post-metadata">

**Author:** ![mjk22071998](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mjk22071998/32/3812_2.png) [@mjk22071998](https://discourse.hibernate.org/u/mjk22071998)\
**Post date:** [February 13, 2025, 1:07pm UTC](https://discourse.hibernate.org/t/what-is-replacement-of-gettypename-in-dialect-class-of-hibernate/10991/5 "2025-02-13T13:07:23Z")

</div>

Out of curiosity what output will be given by `dialect.getTypeName(-16, 255, 0, 0)`? Is it `LONGVARCHAR` or `TEXT` datatype?

---

<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 14, 2025, 9:28am UTC](https://discourse.hibernate.org/t/what-is-replacement-of-gettypename-in-dialect-class-of-hibernate/10991/6 "2025-02-14T09:28:14Z")

</div>

Try it yourself if you’re so curious 😉

---

<div class="post-metadata">

**Author:** ![mjk22071998](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mjk22071998/32/3812_2.png) [@mjk22071998](https://discourse.hibernate.org/u/mjk22071998)\
**Post date:** [February 18, 2025, 6:33am UTC](https://discourse.hibernate.org/t/what-is-replacement-of-gettypename-in-dialect-class-of-hibernate/10991/7 "2025-02-18T06:33:03Z")

</div>

It’s `nvarchar(255)` for every Dialect
