4 Replies Latest reply on Apr 5, 2006 8:22 AM by Martin Ganserer

    Problems with Date

    Martin Ganserer Novice

      Hi,

      I have a problem with Date properties in my entity bean.
      In my project I use JBOSS PFD/MySQL 5.0. The column is of type: DateTime.


      @Temporal(TemporalType.DATE)
      @Column(name="last_date")
      public Date getLastDate()
      {
       return lastDate;
      }


      If I merge the corresponding entity (without changing the value of this property) I get following error message:


      08:49:11,375 INFO [STDOUT] Hibernate: update sys_scheduler_tab set method_name=?, description=?, active=?, interval=?, bean_name=?, in_process=?, last_date=?, process_time=?, next_date=? where id=?
      08:49:11,484 WARN [JDBCExceptionReporter] SQL Error: 1064, SQLState: 42000
      08:49:11,484 ERROR [JDBCExceptionReporter] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval=10000, bean_name='XMLImportServiceBean', in_process='1', last_date='200' at line 1
      08:49:11,484 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
      org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356)
       at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
       at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1488)
       at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1107)
       at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:321)
       at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:219)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:55)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
       at $Proxy222.mergeProcess(Unknown Source)
       at com.kontron.system.scheduler.service.ProcessScheduler.perform(ProcessScheduler.java:133)
       at org.jboss.varia.scheduler.Scheduler$Listener.handleNotification(Scheduler.java:1235)
       at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
       at $Proxy27.handleNotification(Unknown Source)
       at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:221)
       at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:184)
       at javax.management.timer.Timer.sendNotification(Timer.java:1295)
       at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1264)
       at javax.management.timer.TimerAlarmClock.run(Timer.java:1347)
       at java.util.TimerThread.mainLoop(Timer.java:512)
       at java.util.TimerThread.run(Timer.java:462)
      Caused by: java.sql.BatchUpdateException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval=10000, bean_name='XMLImportServiceBean', in_process='1', last_date='200' at line 1
       at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1629)
       at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:517)
       at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
       ... 43 more


      What should I do?