Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you want (to simulate) a bidirectional relation without a join table, you must do this by creating two unidirectional relations and inform Hibernate about the relation between them - by using mappedBy, as JB Nizet says, but also keeping the other (@ManyToOne) mapping </p> <p>@JoinColumn can be used e.g if you want to only map the @OneToMay side of a relation but still don't want a join table - you'll point out a column in other table that should be used, normally unidirectional references don't affect the referenced table and instead uses join tables. You prob don't need @JoinColumn in this case, since by default PK (id) is used in FK constraints in bidirectional relations (t_taskstep.task_id column will have FK constraint to t_task.id)</p> <p>Cascade attribute will cause Create/Delete actions (updates are implicitly handled by EntityManager/Session) on owning entities to cascade down to (in your case) all entities in a Collection. So doing a delete on a Task would also lead to delete of all TaskSteps instances in your steps Collection, and also delete the Operator operator in TaskStep. Brave, but likely to fail since you have @ManyToMany relations involved - other TaskStep instances might reference the very Operator your delete is cascaded to. Normally only cascade save-update (or map relation at a Component/Embedded) and handle deletes manually. If you though are sure that your collection is the only one referencing another entity you could use ALL and also DELETE-ORPHAN and thus cause referenced Entities to be deleted simply by removing them from the Collection.</p> <p>@IndexColumn is used if you want the order of the objects in the List to be remembered. If you don't care, skip it and your relation will have Bag semantics (unordered, duplicated allowed). Often you don't want to see duplicates in a Collection, so the Set Collection should then be used.</p> <p>Kind of long answer, sorry. Should've simply provided the code perhaps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload