Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I cannot help noticing that there is an inconsistency in your question.</p> <p>You first state that:</p> <blockquote> <p>Leafs of these trees can have several children/parents.</p> </blockquote> <p>This in my believe makes the relationship between leafs <strong>many to many</strong>.</p> <p>As I make of your question that <code>EtlWorkflowSeq</code> represent leafs, I think <code>EtlWorkflowSeqNode</code> represents the relationship between <code>EtlWorkflowSeq</code> objects?</p> <p>However, the nodes point to <strong>one</strong> parent and <strong>many</strong> children.</p> <p>You can use something like this to create something similar:</p> <pre><code>@Entity @Table(name="WORKFLOW_SEQ") public class EtlWorkflowSeq { @Id @GeneratedValue @Column(name="WORKFLOW_SEQ_ID") public Integer id; @ManyToOne @JoinColumn(name="WORKFLOW_ID") public EtlWorkflow etlWorkflow; @ManyToMany @JoinTable(name = "WORKFLOW_SEQ_REL") private Set&lt;EtlWorkflowSeq&gt; children; @ManyToMany(mappedBy = "children") private Set&lt;EtlWorkflowSeq&gt; parents; @ManyToOne @JoinColumn(name = "JOB_ID", referencedColumnName = "id") private Job job; } </code></pre> <p>This would make <code>EtlWorkflowSeqNode</code> and <code>EtlWorkflowSeqNodeId</code> obsolete.</p> <p>I also would like to state that when using an <code>@Embeddable</code> you should only use base types in them. Using other than base types is not possible/causes problems/is not standard (correct me if I'm wrong).</p> <p>If you would like to use foreign keys in a composite primary key you can use this:</p> <pre><code>@Entity public class Foo { @Id private Long id; } @Entity public class Bar { @EmbeddedId private BarPK key; @MapsId(value = "fooId") @ManyToOne @JoinColumns({ @JoinColumn(name = "foo_id", referencedColumnName = "id") }) private Foo foo; } @Embeddable public class BarPK { @Column(name = "id") private Long id; @Column(name = "foo_id") private Long fooId; } </code></pre>
    singulars
    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. This table or related slice is empty.
    1. 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