Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>The property emailId is a foreign key referring to say emailId column in User table.</p> </blockquote> <p>Then don't add the <code>emailId</code> property, add a <code>User</code>.</p> <blockquote> <p>(...) How do i annotate this so that, whenever i fetch AppInput from db, the corresponding user details also get populated? </p> </blockquote> <p>Not sure since it could be a <code>ManyToOne</code> or <code>OneToOne</code> but I'll assume it's a <code>ManyToOne</code>:</p> <pre><code>@ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="USERDETAILS_EMAIL_ID", referencedColumnName="EMAIL_ID") private User userDetails; </code></pre> <p>The <code>fetch</code> annotation element is for demonstration purpose, <code>EAGER</code> being actually the default value. The <code>name</code> and <code>referencedColumn</code> annotation elements in <code>JoinColumn</code> are also optional. Below a short summary from the JPA specification:</p> <blockquote> <h3>11.1.21 JoinColumn Annotation</h3> <p>The <code>JoinColumn</code> annotation is used to specify a column for joining an entity association or element collection.</p> <p>Table 20 lists the annotation elements that may be specified for the <code>JoinColumn</code> annotation and their default values.</p> <p>If the <code>JoinColumn</code> annotation itself is defaulted, a single join column is assumed and the default values described in Table 20 apply.</p> <p>The <code>name</code> annotation element defines the name of the foreign key column. The remaining annotation elements (other than <code>referencedColumnName</code>) refer to this column and have the same semantics as for the <code>Column</code> annotation. </p> <p>If the <code>referencedColumnName</code> element is missing, the foreign key is assumed to refer to the primary key of the referenced table.</p> </blockquote> <p>See the <strong>Table 20</strong> in the spec for complete and exhaustive details.</p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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