2012-07-13 84 views
0

我將Spring MVC和Spring Roo一起使用,並且我已經爲其中一個實體添加了JPA finder。我也有@RooWebScaffold和@RooWebFinder註解如下:意外的日期使用Spring Roo和Spring MVC轉換失敗

@RooWebScaffold(path = "plis", formBackingObject = Pli.class) 
@RooWebFinder 

我的一個JPA拾得使用java.util.Date,當我運行@RooWebFinder,我係統地獲得在控制檯下面的例外,我被重定向到404:

2012-07-13 14:13:31,515 ["http-bio-8131"-exec-16] DEBUG org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Resolving exception from handler [public java.lang.String trc.suivi.controller.PliController.findPlisByIdentifiantLikeAndDateReceptionBetweenAndPaiementAndARAndNumeroARLikeAndFDVAndConteneurNumAndStatut(java.lang.String,java.util.Date,java.util.Date,java.lang.Boolean,java.lang.Boolean,java.lang.String,java.lang.Boolean,trc.suivi.domain.ConteneurNum,trc.suivi.domain.StatutPli,org.springframework.ui.Model)]: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.util.Date'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type @org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.util.Date for value '2012-07-04'; nested exception is java.lang.IllegalArgumentException: Invalid format: "2012-07-04" is malformed at "12-07-04" 

我錯過了什麼?

回答

1

看起來你指定是格式不正確的日期: 無效的格式爲:「2012-07-04」在「04年12月7日」

什麼是該領域的最新形成的畸形實體對象?

可以嘗試兩年的日期。