Announcement Announcement Module
No announcement yet.
persistence issue master detail Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • persistence issue master detail

    First of all, congratulations for Roo. Its an amazing tool.

    I am working with a master / detail like domain.
    I will call the entities Master and Detail.

    Master has a Set of Detail
    @OneToMany(cascade = CascadeType.ALL)
    private Set<Detail> detail = new HashSet<Detail>();

    Detail has a Master
    private Master master;

    I am using HIBERNATE with MYSQL, with
    <property name="" value="create"/>

    Starting the project, 3 tables are created in database:

    When I save my Master, it goes to master table, correctly.
    When I save my Detail, it goes to detail table with the correct reference to Master, in the apropriate column.
    But the 3rd table (master_detail) is not getting any values.

    1st question: Why the link table is not getting any values? What I am missing?
    When i retrieve a master, it finds none of his details, because of this empty table (master_detail).

    2nd question: Is this link table (master_detail) necessary? Since its not a m:m relationship, a column in detail could handle the relationship.

  • #2
    a mappedBy property in @onetomay made it.
    now it dont create the link table, all works fine.