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

Error saving Entity with @Embedded field

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.2.5.RELEASE
    • Fix Version/s: 1.3.0.RELEASE
    • Component/s: None
    • Labels:

      Description

      Generate an embeddable class (Parts.java) using Spring Roo and adding as field on another class (Product.java)

      Parts.java
      @RooJavaBean
      @RooToString
      @Embeddable
      public class Parts {
      
          /**
           */
          private String part1Name;
      
          /**
           */
          private String part2Name;
      
          /**
           */
          private String part3Name;
      }
      
      Product.java
      @RooJavaBean
      @RooToString
      @RooJpaActiveRecord
      public class Product {
      
          /**
           */
          private String productName;
      
          /**
           */
          @Embedded
          private Parts parts;
      }
      
      

      When generates web layer using Roo Commands, Embedded field is generated as input field and is not able to save Product entity.

      To solve this, is necessary to generate a Conversor when generates web layer and add a individual input field to every embeddable class fields.

      Attached generated source using ROO commands and modified source with solution implementation.

        Attachments

          Activity

            People

            • Assignee:
              jcgarcia Juan Carlos García del Canto
              Reporter:
              jcgarcia Juan Carlos García del Canto
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: