DetachedCriteria cr = DetachedCriteria.forClass(DealerSales.class).setProjection(Property.forName("dealerCode"));
cr.add(Restrictions.eq("countryCode",01));
Criteria cr1 = session.createCriteria(BrandModelSales.class).add(Subqueries.propertyIn("dealerCode",cr));
下面是一个例外:
SEVERE: Servlet.service() for servlet [spring] in context with path [/Scoreboard] threw exception [Request processing failed; nested exception is java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String] with root cause
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
其中dealecode
作为数字存储在表中,而分离标准将其返回为String
cast()
方法也不起作用.....
除了HQL和本机查询,还有其他方法吗?