Hibernate get List from database

前端 未结 6 1177
盖世英雄少女心
盖世英雄少女心 2021-02-07 22:31

In the following code I am trying to get a List of Products which contains all the products in the database:

public List getAllProducts() throws          


        
6条回答
  •  遇见更好的自我
    2021-02-07 22:38

    Forgot to type cast the query. it is working now.

    List products  = (List) session.createQuery("from Products").list();
    

提交回复
热议问题