Hi everybody, I just wanted to report a possible bug. When an entity has only one field, for example a Date, when the controller is generated, it tries to return a String without adding the toString() method to fields. This cause a compile error:
Code:@InitBinder void ReciboController.registerConverters(WebDataBinder binder) { if (binder.getConversionService() instanceof GenericConversionService) { GenericConversionService conversionService = (GenericConversionService) binder.getConversionService(); conversionService.addConverter(new Converter<Recibo, String>() { public String convert(Recibo recibo) { return recibo.getFecha(); } }); } }Code:[ERROR] Type mismatch: cannot convert from Date to String [WARNING] advice defined in org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect has not been applied [Xlint:adviceDidNotMatch] [WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch] [WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch] [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Compiler errors : error at return recibo.getFecha();


Reply With Quote
