Hi all,
i've got some troubles with an hibernate request.
i've got a find to do but an exception is returned. The problem is the exception isn't returned every time i'm doing the request, sometimes it works very well.
Here's the exception :
Quote:
java/lang/Long incompatible with java/lang/Integer
here's my java code :
Code:
List chains =
HibernateBean.find(
id,
"from ser in class ServiceChainBean where ser.key.serviceId = ?",
sess);
where HibernateBean.find is :
Code:
public static List find(long id, String chaine,Session session) {
try {
Transaction tx = null;
tx = session.beginTransaction();
List liste = session.find(chaine, new Long(id), Hibernate.LONG);
return liste;
} catch (HibernateException e) {
logger.error("HibernateException : " + e);
return null;
}
}
my hibernate version : Hibernate 2.1.2
the error stacktrace :
Quote:
[15/07/04 17:15:08:638 CEST] 134f134f WebGroup I SRVE0181I: [PSInterfaceAdmin] [/PSInterfaceAdminWeb] [Servlet.LOG]: ParamServlet: Dispatch[/serviceDispatchAction] to method allerAjouterServiceChains returned an exception: java.lang.reflect.InvocationTargetException: java.lang.ClassCastException: java/lang/Long incompatible with java/lang/Integer
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.ClassCastException.<init>(ClassCastException.java:56)
at net.sf.hibernate.type.IntegerType.set(IntegerType.java:31)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:48)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:35)
at net.sf.hibernate.persister.EntityPersister.dehydrate(EntityPersister.java:393)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:667)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:641)
at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2382)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2336)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at psInterfaceAdminWeb.beans.HibernateBean.find(HibernateBean.java:179)
at psInterfaceAdminWeb.beans.ServiceChainBean.getServiceNotChains(ServiceChainBean.java)
at psInterfaceAdminWeb.actions.ServiceDispatchAction.allerAjouterServiceChains(ServiceDispatchAction.java)
at java.lang.reflect.AccessibleObject.invokeImpl(Native Method)
at java.lang.reflect.AccessibleObject.invokeL(AccessibleObject.java:207)
at java.lang.reflect.Method.invoke(Method.java:271)
at org.apache.struts.actions.DispatchAction.perform(DispatchAction.java:236)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at com.airfrance.fwstrutslayer.AirFranceStrutsServlet.doGet(AirFranceStrutsServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
and my database is Oracle8
i tried to google the exception, but i can't find anyone having the same problem. any clue ?
Thanks for your attention.