Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Projections in Hibernate 5.2
PostPosted: Mon May 22, 2017 6:53 am 
Newbie

Joined: Mon May 22, 2017 6:45 am
Posts: 2
hello,

In the following link for hibernate 5.2 criteria-projection
http://docs.jboss.org/hibernate/orm/5.2 ... projection

The Example shown in this section uses "session.createCriteria(Cat.class)" which has been deprecated in the newer version of hibernate.

So I am in a dilemma of what is the valid method to perform such a operation ?

Thank you


Top
 Profile  
 
 Post subject: Re: Projections in Hibernate 5.2
PostPosted: Mon May 22, 2017 8:22 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1582
Location: Romania
The Hibernate Criteria is indeed deprecated so you should not use it anymore.

If you need a DTO projection, you can use:

1. the JPQL NEW clause
2. the Hibernate ResultTransformer

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: Projections in Hibernate 5.2
PostPosted: Mon May 22, 2017 1:15 pm 
Newbie

Joined: Mon May 22, 2017 6:45 am
Posts: 2
Thanks for the response.
Hibernate ResultTransformer looks like an interesting topic to me. Will surely give it a go.
And I would suggest to please rectify the example with a valid one since it being the official docs for hibernate will be referred by many.

Thanks


Top
 Profile  
 
 Post subject: Re: Projections in Hibernate 5.2
PostPosted: Mon May 22, 2017 3:10 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1582
Location: Romania
Please file a ticket on the Hibernate Jira.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.