# How to reference the discriminator column in HQL/JPQL

**URL:** <https://discourse.hibernate.org/t/how-to-reference-the-discriminator-column-in-hql-jpql/11125>\
**Category:** Hibernate ORM\
**Created:** [February 26, 2025, 11:46am UTC](https://discourse.hibernate.org/t/how-to-reference-the-discriminator-column-in-hql-jpql/11125 "2025-02-26T11:46:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![T3rm1](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@T3rm1](https://discourse.hibernate.org/u/T3rm1)\
**Post date:** [February 26, 2025, 11:46am UTC](https://discourse.hibernate.org/t/how-to-reference-the-discriminator-column-in-hql-jpql/11125/1 "2025-02-26T11:46:52Z")

</div>

Is it possible to reference the discriminator column in a HQL/JPQL query? I’d like to update it.

```auto
UPDATE Animal SET type = 'DOG'

```

`type` is the column name of the discriminator column. It is not mapped in the entity (possible workaround?). `Animal` uses single table inheritance.

This used to work with Hibernate 5 but no longer does with Hibernate 6, resulting in this error:  
`org.hibernate.query.SemanticException: Could not interpret path expression 'type'`

---

<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 26, 2025, 12:21pm UTC](https://discourse.hibernate.org/t/how-to-reference-the-discriminator-column-in-hql-jpql/11125/2 "2025-02-26T12:21:28Z")

</div>

You can’t just change the type of an entity. It might be possible to map the type to a field in the entity with `@Column(insertable = false, updatable = false)` and update that column via a HQL DML statement, but know that you might be getting yourself into trouble when doing this. Also, you can use native SQL for this if you want.
