标签:
使用Hibernate 进行查询错误:
[Ljava.lang.Object; cannot be cast to mediatek.Pro
In the following code I am trying to get a List of Products which contains all the products in the database:
org.hibernate.Transaction tx = session.beginTransaction(); products = session.createSQLQuery("SELECT * FROM Products").list(); if(products.size() > 0) { return products; } return null;
List<Products> list = session.createCriteria(Products.class).list();
解决方法二:
(List<Products>)session.createSQLQuery("SELECT * FROM Products").addEntity(Products.class).list();
[Ljava.lang.Object; cannot be cast to mediatek.Pro
标签:
原文地址:http://my.oschina.net/liting/blog/526957