Announcement Announcement Module
No announcement yet.
Domain Model Best Practises Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Domain Model Best Practises

    Hi Everyone,
    I'm trying to get an idea of the recommended best practise for domain model design when working with Spring 3 MVC. I have a well-defined domain data model in place in which many bi-directional relationships exist.
    When binding this to a spring form, this then becomes problematic because the inter-object relationships cannot be bound on a spring form. It would appear that most people take the approach of creating proxy form-backing beans that pass id references between the web tier and the controller, which are then converted into domain beans when you write down to the persistence layer.
    However this seems like a lot of duplication in code just to handle the associations. Additionally, I still want much of the domain objects available in the web tier for rendering a view, e.g. showing all records related to a parent.
    I have also considered writing convenience methods onto my domain beans to get/set related bean ids, however this then introduces a mess in the domain beans where they must notify the persistence layer that an id is changed and therefore the related object must be looked up and set in the domain bean.
    There would seem to be a variety of approaches here, but considering that that app I'm building really just needs to facilitate basic CRUD operations against my domain model I'm trying to avoid bloating the service layer with a bunch of type conversions just to get my forms to work.
    Any suggestions of a clean + simple approach welcomed.