I have a @Entity called Order in this I have a field or a member variable called orderEmails as show below.
@Entity
@Table(name = \"order\")
public class Order {
I guess hibernate does not provide such a function. To do this you will have to use database specific functions like LISTAGG from Oracle or GROUP_CONCAT from MySQL. It will group all emails (the String) into one colum, so the result would be:
ORDER_ID EMAILS
1 nemo@email, dory@email, whale@email
2 spongebob@email, squarepants@email
You can use database specific functions in Hibernate with sqlProjection, so the code will look something like this:
public List