Announcement Announcement Module
Collapse
No announcement yet.
Posible bug in Controllers of entities of one field Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Posible bug in Controllers of entities of one field

    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();

  • #2
    Indeed, that is a problem. Please raise a bug for it.

    Cheers,
    Stefan

    Comment

    Working...
    X