Announcement Announcement Module
No announcement yet.
Embedded Value Objects and Scaffolded views Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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:

    public class MyEntity {
        private MyValueObject myValueObject
    public class MyValueObject {
        private String firstName;
        private String lastName;
    Is there a way to get a JSP created that can handle it?


  • #2

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



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


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


        • #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.


          • #6
            That's hardly a real solution.


            • #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?


              • #8

                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.



                • #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.


                  • #10

                    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.

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