Results 1 to 2 of 2

Thread: Multiple entity controller needed

  1. #1

    Post Multiple entity controller needed

    Hi all

    I have a customer entity
    I have an activity entity

    They both share a key pack_id

    I wish to create a single screen for entering both customer and actity data and a single submit that writes to both tables.

    I have tried to creting both controllers and meerging code but running into issues.

    Code:
    org.springframework.beans.NotReadablePropertyException: Invalid property 'customer_address1' of bean class
    I have taken the jsp for one of the entities and merged it with the other.

    There appears to be a mapping stage that falls over trying to place these extra elemetns on the customer objetct opposed to the activity object.

    As this class is within the framework was not sure how to progress.

    Has anyone else written to two elements from a single controller and jsp page using roo?

    Cheers

    Joe

  2. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Hi Joe,

    As you noticed the scaffolded views have a 1:1 mapping between form backing objects and the view artifacts. If you would like to merge two entities into a single form you need to do some manual work. It would probably be best if you start with a 'controller class', create a custom form backing object (which contains the fields of both entities) and use that for your data exchange between the controller and your custom views.

    Alternatively, you can use something like Json as data exchange format as detailed in Keith Donalds bog post: http://blog.springsource.com/2010/01...in-spring-3-0/

    HTH,
    -Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •