hibernate fetch specific column from database using criteria
I want to fetch specific column from database by using criteria.
开发者_StackOverflow社区select name, lastname from sssssss
Please reply
Thanks in advance.
you need to use the projecttion Class.. check this documentation for details..
List results = session.createCriteria(SSSS.class)
.setProjection( Projections.projectionList()
.add( Projections.property("name") )
.add( Projections.property("lastName") )
)
.list();
精彩评论