简体   繁体   中英

How to get values from pojo list

I am storing values of below query is a list which having type pojo class. I need to get each videos from vList.And I wants How can I retrive in a loop. Dao.java

@SuppressWarnings("unchecked")
@Override
public List<Videos> getFullVideoList(long albumid) {
    // TODO Auto-generated method stub
    // albumid=11;
    session=sessionFactory.openSession();
    tx=session.beginTransaction();
    Query query = session.createQuery( "from Videos where  videoStatus=1");
    query.setParameter("albumid", albumid).setParameter("videotype","VDSG");;
    List<Videos> vList=query.list();
tx.commit();
    session.close();
    return vList;
}

simply iterate it using any loop

if the size of the list is too large, then don't use .list() method. You may get outOfMemory error.

Instead use statelesssession and scrollable resultset. This will be more fast and efficient.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM