Announcement Announcement Module
Collapse
No announcement yet.
Embedded Value Objects and Scaffolded views Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Embedded Value Objects and Scaffolded views

    I use a lot of Value Objects in my domain model and ROO doesn't seem to be able to handle them in the scaffolded views, instead I just get a single form field for the Embedded value. So, if I have code like this:

    Code:
    @Entity
    @RooEntity
    public class MyEntity {
    
        @Embedded
        private MyValueObject myValueObject
    }
    
    @Embeddable
    public class MyValueObject {
    
        private String firstName;
        private String lastName;
    
    }
    Is there a way to get a JSP created that can handle it?

    Jon

  • #2
    @metronical,

    Sorry for the delayed response. Can you open a Jira improvement ticket for this so we can take a closer look?

    Thanks,
    Stefan

    Comment


    • #3
      I have the same problem, and seems that Roo isn't able to handle this.

      Comment


      • #4
        Yes, I have too. It is very import to implement it. Otherwise I dare not to use this feature.

        Comment


        • #5
          treat value object as yet another entity object to force roo to generate code.

          I was thinking, for example if an application needs a value object with ten fields, (the data for these ten fields may be mapped to some fields in entity class already defined), go ahead and create yet another entity class that has all the fields that are needed by the value object and force the roo framework to generate all the required files (including controller) for this entity class also, then fill in the blanks and take over the implementation for the newly created files.

          Is this an accepted practice in the spring roo world to solve the issue of value objects? In short, treat value object as yet another entity and deal with generated code.

          Comment


          • #6
            That's hardly a real solution.

            Comment


            • #7
              How to handle value objects (Data Transfer Objects) in Spring roo?

              What would be a real solution to handle value object (a.k.a. Data Transfer Objects) in Spring Roo then?

              Comment


              • #8
                @vganesh,

                VOs/DTOs are legacy notions from old ejb1/ejb2...

                There are unnecessary with JPA(EJB3). You can round-trip your entities and reattach them to the Entity Manager anytime.

                Thx
                jD

                Comment


                • #9
                  Originally posted by vganesh View Post
                  What would be a real solution to handle value object (a.k.a. Data Transfer Objects) in Spring Roo then?
                  I'm not talking about DTO's. I'm talking about value objects as in not being entities with identity and changeable state, but as in immutable objects without identity as is this original poster as far as I can see. See DDD for further details.

                  The real solution would be for Roo to handle everything that JPA2 handles.

                  Comment


                  • #10
                    @MiB,

                    Roo uses JPA2 already...
                    It might not generating code the way you want. For that purpose you can 1)create an example to illustrate how should be generated then and -most importantly- 2)How we move from where we are now to the new stuff. It might be an add-on, I guess.


                    Roogards
                    jD
                    Last edited by delgad9; Nov 30th, 2011, 09:43 AM. Reason: Clean up

                    Comment

                    Working...
                    X