Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-3945

Incorrect code generated in each entity Deserializer_Roo_EntityDeserializer.aj files


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Works as Designed
    • Affects Version/s: 2.0.0.RC2
    • Fix Version/s: None
    • Component/s: @ ROO SHELL
    • Labels:


      Given the roo commands to generate a project below the following function is generated for each EntitySerializer, I'm pretty sure this code is incorrect as it tries to fetch data from the database during ObjectMapper Deserialization, which should probably never happen as object deserialization shouldn't be hitting the database just to convert json into a java object

           * TODO Auto-generated method documentation
           * @param jsonParser
           * @param context
           * @param codec
           * @param tree
           * @return ProblemEntity
           * @throws IOException
          public ProblemEntity ProblemEntityDeserializer.deserializeObject(JsonParser jsonParser, DeserializationContext context, ObjectCodec codec, JsonNode tree) throws IOException {
              String idText = tree.asText();
              Long id = conversionService.convert(idText, Long.class);
              ProblemEntity problemEntity = problemEntityService.findOne(id);
              if (problemEntity == null) {
                  throw new NotFoundException("ProblemEntity not found");
              return problemEntity;

      Reproduction Steps:

      1. Run the following roo commands

      // Spring Roo 2.0.0.RC2 [rev 76d128f] log opened at 2017-11-30 14:20:31
      project setup --topLevelPackage CodeGenerationProblemExample --projectName "CodeGenerationProblem" --java 8 --packaging JAR
      // Spring Roo 2.0.0.RC2 [rev 76d128f] log closed at 2017-11-30 14:20:33
      // Spring Roo 2.0.0.RC2 [rev 76d128f] log opened at 2017-11-30 14:20:35
      jpa setup --provider HIBERNATE --database MYSQL
      entity jpa --class ~.problemexample.ProblemEntity
      field string title
      field string description
      repository jpa --all
      service --all
      web mvc setup
      web mvc controller --all --responseType JSON --pathPrefix /api

      2. check the following file for the incorrectly generated code.





            • Assignee:
              jmvivo Jose Manuel Vivó ( Chema ) - DISID.
              gandalf.hudlow Gandalf Hudlow
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: