I have a named query as following:
* @hibernate.query name="BusinessUnit.getBusinessUnitsForIDList" query=" select distinct \ * new com.cscinfo.cdsapp.model.hbm.BusinessUnit (bu.id, bu.businessUnitName, bu.dfltBusunitNameServerProfid)\ * from BusinessUnit bu\ * where bu.id in (:businessUnitIdList)"
When running the code, I have a string parameter whose value resolves to '5902', '95'. But the binding is throwing error since 'bu.id' is of type long.
26 Aug 2008 00:24:45,704 INFO HostTemplateDAOHibernate strForParameter : '5902', '95'
Hibernate:
select
distinct businessun0_.businessUnitId as col_0_0_,
businessun0_.businessUnitName as col_1_0_,
businessun0_.dfltBusunitNameServerProfid as col_2_0_
from
businessUnit businessun0_
where
businessun0_.businessUnitId in (
?
)
26 Aug 2008 00:24:45,704 INFO LongType could not bind value ''5902', '95'' to parameter: 1; java.lang.String
26 Aug 2008 00:24:45,736 ERROR [cdsapp] Servlet.service() for servlet cdsapp threw exception
java.lang.ClassCastException: java.lang.String
at org.hibernate.type.LongType.set(LongType.java:42)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:116)
at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:38)
at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:491)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1563)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at com.cscinfo.cdsapp.dao.hibernate.HostTemplateDAOHibernate.checkAndRemoveDefaultRelationShip(HostTemplateDAOHibernate.java:454)
at com.cscinfo.cdsapp.dao.hibernate.HostTemplateDAOHibernate.deleteBUToBeDeleted(HostTemplateDAOHibernate.java:426)
|