How to choose a list of entities with custom attributes set through Criteria API if the entity has an associated collection of other entities?

Hello. Is the substance, which is one of the fields is a collection of other entities:
class UserEntity {
private Long id;
private String name;
private Set<GroupEntity> groups;
private byte[] avatar;

You need to list those users via Criteria API, and you need not choose all fields (one field should be excluded - avatar). But the field with the collection of entities to be sampled.

Searched the Internet - found.
April 3rd 20 at 18:34
1 answer
April 3rd 20 at 18:36
The question is not clear. If CriteriaApi can get a stream of arbitrary objects (UserEntity) that
a stream is always possible to apply the map method to take only nuiy stream fields.
.stream().map(userEntity -> userEntity.getAvatar)....
The answer is not clear. And wonder why the strange question. I need to select all the fields from the database, except for the avatar. What is not clear? 've done this before using Criteri API, but at that time I was not in entity collection of related entities. Now there is, and I don't know how to initialize. - Logan32 commented on April 3rd 20 at 18:39
A Stream API here at all in the subject, in any case - Logan32 commented on April 3rd 20 at 18:42

Find more questions by tags JavaHibernate