How do you select a column using Hibernate?

You can set the Projection for this like:

.setProjection(Projections.property("firstname"))

With this you can only get the firstname in return.

I have found another link on stack with the same scenario. Hope this will also help How to use hibernate criteria to return only one element of an object instead the entire object?

Leave a Comment