Announcement Announcement Module
Collapse
No announcement yet.
(Binding) Forms for inheritance domain models Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • (Binding) Forms for inheritance domain models

    I got a problem with an inheritance domain model and the generated forms.

    Here is a part of my roo log:

    entity --class ~.domain.Base --abstract --inheritanceType SINGLE_TABLE
    field string --fieldName created_by
    field string --fieldName updated_by
    field date --fieldName created_at --type java.util.Date
    field date --fieldName updated_at --type java.util.Date
    entity --class ~.domain.BaseUser --abstract --extends ~.domain.Base
    field string --fieldName uid
    entity --class ~.domain.Employee --extends ~.domain.BaseUser --testAutomatically
    field string --fieldName employeenumber --notNull
    field string --fieldName firstname --notNull
    field string --fieldName lastname --notNull
    ...

    Base <-- BaseUser <-- Employee

    The generated forms for the Employee model includes also the abstract fields. But these fields are set automatically. If i delete these fields from the form, the values for that attributes are set "null".

    Is there a way to ingnore those fields?

    Thank's a lot!

    Cheers
    Mario

  • #2
    If you want these fields to be auto populated with data you need to push in the relevant controller methods and simply set the values you need there. In case you don't want some of the fields rendered in the views simply add 'render="false"' to the relevant tags in your jspx files (this works with the Roo 1.1 releases).

    HTH,
    Stefan

    Comment


    • #3
      Originally posted by Stefan Schmidt View Post
      If you want these fields to be auto populated with data you need to push in the relevant controller methods and simply set the values you need there. In case you don't want some of the fields rendered in the views simply add 'render="false"' to the relevant tags in your jspx files (this works with the Roo 1.1 releases).
      Hi Stefan, thank's for your answer. My Roo version is 1.1.0.M2 [rev 0b3543e].

      The problem still exists. I created a dataset of a concrete (employee) entity:

      Logger output after persist :
      Code:
      2010-08-20 10:13:20,208 [http-8080-1] INFO  ...web.EmployeeController - ResultTarget: Id: 218, Version: 0, Created_by: mschubert, Updated_by: null, C
      reated_at: Fri Aug 20 10:13:20 CEST 2010, Updated_at: null, Uid: mschubert, Employeenumber: 11111, Firstname: Mario, Lastname: Schubert, Birthday: Fri Aug 20 00:00:00 CES
      T 2010, EmployeeType: intern
      The update:

      Update.jspx:
      Code:
      <field:input render="false" field="created_by" ...
      <field:input render="false" field="uid"...
      Logger-Ouput before merge in the update action:
      Code:
      2010-08-20 10:14:35,159 [http-8080-2] INFO  ...web.EmployeeController - Employee: Id: 218, Version: 0, Created_by: null, Updated_by: null, Creat
      ed_at: null, Updated_at: null, Uid: null, Employeenumber: 11111, Firstname: Mario, Lastname: Schubert, Birthday: Fri Aug 20 00:00:00 CEST 2010,EmployeeType: intern
      The abstract attributes are still set to "null"...Is there a way to avoid that behaviour?

      Thank's!

      Cheers
      Mario
      Last edited by Mario Schubert; Aug 20th, 2010, 04:19 AM.

      Comment

      Working...
      X