Datum im String-Format vergleichen

@zeja: Hier die Exception:

Code:
org.springframework.orm.hibernate3.HibernateSystemException: Exception occurred inside getter of de.XYZ.franky.orm.base.AbstractFrtasklist.taskDate; nested exception is org.hibernate.PropertyAccessException: Exception occurred inside getter of de.XYZ.franky.orm.base.AbstractFrtasklist.taskDate
Caused by: 
org.hibernate.PropertyAccessException: Exception occurred inside getter of de.XYZ.franky.orm.base.AbstractFrtasklist.taskDate
	at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:148)
	at org.hibernate.tuple.AbstractEntityTuplizer.getPropertyValues(AbstractEntityTuplizer.java:249)
	at org.hibernate.tuple.PojoEntityTuplizer.getPropertyValues(PojoEntityTuplizer.java:197)
	at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyValues(AbstractEntityPersister.java:3242)
	at org.hibernate.pretty.Printer.toString(Printer.java:50)
	at org.hibernate.pretty.Printer.toString(Printer.java:90)
	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:97)
	at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:35)
	at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:978)
	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:135)
	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:113)
	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1602)
	at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:837)
	at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
	at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:835)
	at de.XYZ.franky.web.Controller.Status.StatusController.referenceData(StatusController.java:87)
	at org.springframework.web.servlet.mvc.AbstractFormController.showForm(AbstractFormController.java:559)
	at de.XYZ.franky.web.Controller.BasefrankyController.showForm(BasefrankyController.java:112)
	at de.XYZ.franky.web.Controller.BasefrankyController.showForm(BasefrankyController.java:70)
	at org.springframework.web.servlet.mvc.AbstractFormController.showNewForm(AbstractFormController.java:323)
	at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:263)
	at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:819)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:754)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:399)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:354)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:183)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
	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.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:145)
	... 46 more
Caused by: java.lang.NullPointerException
	at de.XYZ.franky.orm.base.AbstractFrtasklist.getTaskDate(AbstractFrtasklist.java:92)
	... 51 more
taskDate ist das Datum, das als String in der DB liegt.

@orlando11: Die Idee an sich klingt echt klasse, aber ich hab keinen Einfluss darauf, wie die Daten aus der Datenbank ausgelesen werden, weil das Hibernate für mich übernimmt.


Edit sagt: Die Exception wird natürlich nur geworfen, wenn ich in Setter und Getter den Timestamp in einen String bzw. den String in einen Timestamp umwandel...
 
Zuletzt bearbeitet:
Zurück