-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: hibernate detached criteria exclude column
PostPosted: Thu Dec 07, 2017 8:54 am 
Newbie

Joined: Thu Dec 07, 2017 8:52 am
Posts: 1
I would like to exclude 1 column and I'm using detached criteria. how to achieve that.


Top
 Profile  
 
 Post subject: Re: hibernate detached criteria exclude column
PostPosted: Thu Dec 07, 2017 12:06 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
The Hibernate legacy Criteria and DetachedCriteria are no longer supported.

If you want to do that with JPA Criteria, you can use something like that:

Code:
CriteriaQuery<Object[]> q = cb.createQuery(Object[].class);
Root<MyEntity> c = q.from(MyEntity.class);
q.select(cb.array(c.get("id"), c.get("name"));


Or you can use a Tuple to hold the projection as described in this article.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.