Results 1 to 2 of 2

Thread: Posible bug in Controllers of entities of one field

  1. #1
    Join Date
    Mar 2010
    Posts
    4

    Default 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. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

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

    Cheers,
    Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •