你好我有一个查询带来Hibernate XML的SQL-Query列表问一个问题,如果我想在一个变量中捕获一个查询列的值我就失败了:
Query query = sessionFactory.openSession().getNamedQuery("getListCustomers");
List<Customer> listaResultados = query.list();
for (int i = 0; i < listaResultados.size(); i++) {
System.out.println("Nombre " + i + ": " + listaResultados.get(i));
Map values = (Map) listaResultados.get(i);
Integer code = Integer.parseInt(values.get("code").toString());
System.out.println("===> code: "+code);
}
这让我在控制台中,在地图中失败:
Hibernate: SELECT ba_customer_id,
ba_company_id,
code,
name,
comercial_name,
discount,
is_active,
created,
observation
FROM ba_customer
exception is java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.Map] con causa raíz
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.Map