-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Value '0000-00-00' can not be represented as.Timestamp
PostPosted: Mon Feb 13, 2012 10:37 am 
Newbie

Joined: Tue Nov 16, 2010 9:43 am
Posts: 19
Hi ,

Please can any one resolve the following issue...


In My project am using

DB : Mysql 5.0
Hibernate : 3.0

In My hbm i have property of type date and in the db it's holding 0000-00-00

And also iam setting following property in configuration file :

Code:
hibernate.connection.zeroDateTimeBehavior=convertToNull



When iam loading Data from the table as DomainObject am getting following Exception...


Code:
java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
   at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:1033)
   at com.mysql.jdbc.ByteArrayRow.getTimestampFast(ByteArrayRow.java:127)
   at com.mysql.jdbc.ResultSetImpl.getTimestampInternal(ResultSetImpl.java:6748)
   at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:6067)
   at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:6105)
   at com.mchange.v2.c3p0.impl.NewProxyResultSet.getTimestamp(NewProxyResultSet.java:3394)
   at org.hibernate.type.TimestampType.get(TimestampType.java:53)
   at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:186)
   at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:175)
   at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)
   at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2267)
   at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1423)
   at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1351)
   at org.hibernate.loader.Loader.getRow(Loader.java:1251)
   at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:619)
   at org.hibernate.loader.Loader.doQuery(Loader.java:745)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
   at org.hibernate.loader.Loader.doList(Loader.java:2294)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
   at org.hibernate.loader.Loader.list(Loader.java:2167)
   at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:448)
   at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
   at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
   at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1015)
   at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1)
   at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
   at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
   at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:1006)
   at com.dtdc.ng.dao.purchase.GoodsIssueDAOImpl.getDtlsByIssueNoForReceipt(GoodsIssueDAOImpl.java:951)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy11.getDtlsByIssueNoForReceipt(Unknown Source)
   at com.dtdc.ng.bs.purchase.goods.GoodsIssueServiceImpl.findGoodsReceiptPToPByIssueNo(GoodsIssueServiceImpl.java:1923)
   at com.dtdc.ng.action.purchase.goods.GoodsReceiptPlantTOPlantAction.findGoodsIssuePToP(GoodsReceiptPlantTOPlantAction.java:274)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
   at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
   at com.capgemini.lbs.framework.wrappers.CTBSRequestProcessor.processActionPerform(CTBSRequestProcessor.java:30)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at com.capgemini.lbs.framework.filters.CTBSFilter.doFilter(CTBSFilter.java:101)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Unknown Source)
2012-02-13 19:59:34,195 [http-8080-2] WARN - SQL Error: 0, SQLState: S1009
2012-02-13 19:59:34,195 [http-8080-2] ERROR - Value '0000-00-00' can not be represented as java.sql.Timestamp
2012-02-13 19:59:34,195 [http-8080-2] DEBUG - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2012-02-13 19:59:34,195 [http-8080-2] DEBUG - Unable to translate SQLException with Error code '0', will now try the fallback translator
2012-02-13 19:59:34,210 [http-8080-2] DEBUG - Extracted SQL state class 'S1' from value 'S1009'
2012-02-13 19:59:34,210 [http-8080-2] DEBUG - Closing Hibernate Session


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.