I the date class to be org.apache.isis.applib.value.Date I was able to create the instance, and I used "Today", however, it saved the date with yesterday's date.
My dom field "shift_date" was set to: 2012-05-08 Isis did set its "modified_on" field correctly: 2012-05-09 14:52:09.265 Jason Richardson -----Original Message----- From: Richardson, Jason - FSA, Kansas City, MO [mailto:[email protected]] Sent: Wednesday, May 09, 2012 2:23 PM To: [email protected] Subject: RE: Problem with Date fields on my Domain Objects I'm going to try that next. Jason Richardson National Payments Service (NPS) Technical Lead USDA/FSA/AFAO/SCADG (Administrative and Financial Applications Office) (Service Center Accounting & Debt Group) Office Ph: (816) 823-5296 Cubicle: 3NW024 NPS I.T. Matrix (JIRA) NPS Email Groups Listing -----Original Message----- From: Dan Haywood [mailto:[email protected]] Sent: Wednesday, May 09, 2012 2:17 PM To: [email protected] Subject: Re: Problem with Date fields on my Domain Objects Hmm, Kevin's the expert on this, but as a workaround, if you convert to using the applib Datetime in your POJO rather than a java.util.Date, then maybe that would work? Dan On 9 May 2012 19:49, Richardson, Jason - FSA, Kansas City, MO < [email protected]> wrote: > Using today, I got this exception. > > java.util.Date cannot be cast to org.apache.isis.applib.value.DateTime > java.lang.ClassCastException: java.util.Date cannot be cast to > org.apache.isis.applib.value.DateTime > at > org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.JdbcDateTimeMapper.preparedStatementObject(JdbcDateTimeMapper.java:51) > at > org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping.appendInsertValues(AbstractJdbcFieldMapping.java:59) > at > org.apache.isis.runtimes.dflt.objectstores.sql.auto.AbstractAutoMapper.values(AbstractAutoMapper.java:315) > at > org.apache.isis.runtimes.dflt.objectstores.sql.auto.AutoMapper.createObject(AutoMapper.java:134) > at > org.apache.isis.runtimes.dflt.objectstores.sql.SqlObjectStore$1.execute(SqlObjectStore.java:152) > at > org.apache.isis.runtimes.dflt.objectstores.sql.SqlObjectStore.execute(SqlObjectStore.java:287) > at > org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.ObjectStoreTransaction.doFlush(ObjectStoreTransaction.java:130) > at > org.apache.isis.runtimes.dflt.runtime.transaction.IsisTransactionAbstract.commit(IsisTransactionAbstract.java:107) > at > org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.ObjectStoreTransactionManager.endTransaction(ObjectStoreTransactionManager.java:97) > at > org.apache.isis.runtimes.dflt.runtime.transaction.IsisTransactionManagerAbstract.executeWithinTransaction(IsisTransactionManagerAbstract.java:154) > at > org.apache.isis.runtimes.dflt.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:52) > at > org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl.execute(ObjectActionImpl.java:404) > at > org.apache.isis.viewer.html.task.MethodTask.completeTask(MethodTask.java:103) > at > org.apache.isis.viewer.html.task.TaskStep.execute(TaskStep.java:203) > at > org.apache.isis.viewer.html.servlet.internal.WebController.runAction(WebController.java:382) > at > org.apache.isis.viewer.html.servlet.internal.WebController.generatePage(WebController.java:285) > at > org.apache.isis.viewer.html.servlet.ControllerServlet.processRequest(C > ontrollerServlet.java > > > > Jason Richardson > > > -----Original Message----- > From: Kevin Meyer - KMZ [mailto:[email protected]] > Sent: Wednesday, May 09, 2012 1:03 PM > To: [email protected] > Subject: Re: Problem with Date fields on my Domain Objects > > Hi Jason, > > Here's a quick test: > > In the date field, enter "today" and see how it formats the date. You > might be up against Java regionalisation affected which date formats > it considers are valid. > > "Today" is a special text value, and ought to be accepted. > > After that, see if you can reverse engineer the date format? > > Regards, > Kevin > > On 9 May 2012 at 16:34, Richardson, Jason - FSA, Kans wrote: > > > I have a domain object that has a java.util.Date. > > When running my app, I can't get a date to be accepted. I have > > tried > multiple date formats. And I even put in a property. > > isis.value.format.date=dd/MM/yyyy > > > > My DOM has this for the code: > > It's a java.util.Date. > > > > > > private Date shiftDate; > > > > @MemberOrder(sequence = "1") > > public Date getShiftDate() { > > return shiftDate; > > } > > > > public void setShiftDate(Date shiftDate) { > > this.shiftDate = shiftDate; > > } > > > > > > Example return on my webpage: > > * Not recognised as a date: 05/09/2012 > > > > > > Jason Richardson > > > > > > > This electronic message contains information generated by the USDA > solely for the intended recipients. Any unauthorized interception of > this message or the use or disclosure of the information it contains > may violate the law and subject the violator to civil or criminal > penalties. If you believe you have received this message in error, > please notify the sender and delete the email immediately. > >
