开发者

hibernate fetch specific column from database using criteria

开发者 https://www.devze.com 2023-03-20 13:36 出处:网络
I want to fetch specific column from database by using criteria. 开发者_StackOverflow社区 select name, lastname from sssssss

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

精彩评论

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

关注公众号