Deprecation of Hibernate Criteria and how we can still prevent it

What about DTO’s?

Many of us use a DTO’s for sending data to the client instead of entities, even in many cases we use criteria api for fetching them directly, but with JPA Criteria this is no longer supported, it only works with entities. Yes i can a make a tuple and convert to the target dto, but it is not the same, with DTO’s i can define an hbm and use the dto for querying any where in the project.

At first, i have the same attitude as the creator of the post, but i convinced myself of using it because what i like of java the most is the strong typing. Yes JPA criteria has stolen what critera api gave us: the simplicity of query writing, and i found frustrating that this tool accustomed us to this and suddendly take it away, saying that meta model is going to avoid mistakes when we write queries is just a lie, because now we sometimes interchange similar properties of the entity, so errors are always there no matter the tool. But as i said, convinced myself to use it.

So if you remove criteria api completely, i will no longer be capable of using hbm for mapping DTO’s, or is there any way for getting arounf of this? i mean use dtos for querying just as i use entities.

Thanks.