# The issue of DTO projection return type

**URL:** <https://discourse.hibernate.org/t/the-issue-of-dto-projection-return-type/10711>\
**Category:** Hibernate ORM\
**Created:** [November 30, 2024, 2:25pm UTC](https://discourse.hibernate.org/t/the-issue-of-dto-projection-return-type/10711 "2024-11-30T14:25:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cuihaohao](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/cuihaohao/32/3627_2.png) [@cuihaohao](https://discourse.hibernate.org/u/cuihaohao)\
**Post date:** [November 30, 2024, 2:25pm UTC](https://discourse.hibernate.org/t/the-issue-of-dto-projection-return-type/10711/1 "2024-11-30T14:25:38Z")

</div>

Where is the source code for HIBERNATE ORM to parse hql into select expressions? I have a question that I am very confused about. When I use immutable class to query, it is normal to query. But when I use mutable class, I need to convert them.  
I am using JPA and HIBERNATE  
ImmutableDTO immutableDTO = repository.findById(int id);  
NormalDTO normalDTO = repository.findById(int id);

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/hibernate/original/2X/f/f7b8e3333d54ce6fae9c315c3ac0e39e5f899267.png)  
The query of immutable class will be executed to this position .  
So please tell me the parsing rules for expressions or whether there is any processing done for immutable class DTO Projection or interface DTO Projection during parsing

---

<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:** [December 2, 2024, 11:20am UTC](https://discourse.hibernate.org/t/the-issue-of-dto-projection-return-type/10711/2 "2024-12-02T11:20:00Z")

</div>

You can find Hibernate’s source code here: [GitHub - hibernate/hibernate-orm: Hibernate's core Object/Relational Mapping functionality](https://github.com/hibernate/hibernate-orm).

Query parsing and return type interpretation is a major component of Hibernate ORM’s logic, so we can not simply “tell you the parsing rules for expressions”. If you need help, please formulate specific questions and give us more context to understand what you’re trying to achieve.
