Topic: 怎么println List |
Print this page |
1.怎么println List | Copy to clipboard |
Posted by: vincentlaw Posted on: 2005-04-25 17:08 //GetData.java import org.hibernate.*; import org.hibernate.cfg.*; import java.io.*; import java.util.*; public class GetData { public static void main(String[] args) { try { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session session = sf.openSession(); Transaction tx = session.beginTransaction(); String hql="from User as user where 1=1"; Query query=session.createQuery(hql); List userList=query.list(); System.out.println("List's length is:"+userList.size()); while (userList.next()) { //怎么输出userList的内容。谢谢。 } tx.commit(); session.close(); } catch (HibernateException e) { e.printStackTrace(); } } } |
2.Re:怎么println List [Re: vincentlaw] | Copy to clipboard |
Posted by: 铁针 Posted on: 2005-04-26 08:37 override the toString() method |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |