使用hibernate的查询方法,结果显示一串代码而不是结果怎么办

代码如下

//查询所有
    @Test
    public void test8(){
        List<Customer> list = customerDao.findAll();
        for (Customer customer:list){
            System.out.println(customer);
        }
    }

结果显示

Hibernate: select customer0_.cust_id as cust_id1_0_, customer0_.cust_address as cust_add2_0_, customer0_.cust_industry as cust_ind3_0_, customer0_.cust_level as cust_lev4_0_, customer0_.cust_name as cust_nam5_0_, customer0_.cust_phone as cust_pho6_0_, customer0_.cust_source as cust_sou7_0_ from customer customer0_
com.domain.Customer@2c750b69
com.domain.Customer@6c569caf
com.domain.Customer@29a5f924
com.domain.Customer@5f6ba085

想请问一下怎么让它能变成正常查询的结果

这里默认打印的是对象的地址,你需要重写custom的toString方法将其属性打印出来

你可能要再去看看se

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^