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

Error saving Entity with @Embedded field

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Complete
    • 1.2.5.RELEASE
    • 1.3.0.RELEASE
    • None

    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

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

            Dates

              Created:
              Updated:
              Resolved: