如题,现在需要取出一条记录的部分字段。
因为有一个字段不需要用到,并且那个字段的数据量很大(相当于论坛显示贴子列表时不需要读取贴子内容一样)
请问该怎么做?

解决方案 »

  1.   

    String hql="select t.字段1,t.字段2... from Tab t";
    查询返回时个数组,楼主再去读取吧
      

  2.   

    SELECT columnname from tablename
    这样不就可以了么
      

  3.   

    如果你还想返回的是对像而不是LIST<Object[]>可以使用
    selec new TProduct(productid, productname) from TProduct
    注意TProduct类中要有相应的构造方法
    public TProduct(String productid, String productname) {
       this.productid = productid;
       this.productname = productname;
    }