开发者

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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜