<div dir="ltr">conpota$B$H?=$7$^$9!#(B<br><br>S2JDBC$B$r;n$7$F$$$^$9!#(B<br>$B0J2<%F!<%V%k$,$"$C$?$H$7$F!"(B<br><br>CREATE TABLE one(<br>&nbsp; id SERIAL PRIMARY KEY,<br>&nbsp; name VARCHAR(64) NOT NULL<br>);<br>insert into one(name) values(&#39;one1&#39;);<br>insert into one(name) values(&#39;one2&#39;);<br>
<br>CREATE TABLE two(<br>&nbsp; id SERIAL PRIMARY KEY,<br>&nbsp; name VARCHAR(64) NOT NULL<br>);<br>insert into two(name) values(&#39;two1&#39;);<br>insert into two(name) values(&#39;two2&#39;);<br><br>CREATE TABLE three(<br>&nbsp; id SERIAL PRIMARY KEY,<br>
&nbsp; name VARCHAR(64) NOT NULL<br>);<br>insert into three(name) values(&#39;three1&#39;);<br>insert into three(name) values(&#39;three2&#39;);<br><br>CREATE TABLE one_two(<br>&nbsp; id SERIAL PRIMARY KEY,<br>&nbsp; one_id INTEGER NOT NULL,<br>
&nbsp; two_id INTEGER NOT NULL,<br>&nbsp; FOREIGN KEY (one_id) REFERENCES one (id),<br>&nbsp; FOREIGN KEY (two_id) REFERENCES two (id)<br>);<br>insert into one_two(one_id, two_id) values(2, 1);<br>insert into one_two(one_id, two_id) values(2, 2);<br>
<br>CREATE TABLE two_three(<br>&nbsp; id SERIAL PRIMARY KEY,<br>&nbsp; two_id INTEGER NOT NULL,<br>&nbsp; three_id INTEGER NOT NULL,<br>&nbsp; FOREIGN KEY (two_id) REFERENCES two (id),<br>&nbsp; FOREIGN KEY (three_id) REFERENCES three (id)<br>);<br>
insert into two_three(two_id, three_id) values(1, 1);<br>insert into two_three(two_id, three_id) values(2, 1);<br><br>$B$3$l$i$N%(%s%F%#%F%#%/%i%9$N4XO"%W%m%Q%F%#$r0J2<$N$h$&$K=q$-$^$7$?!#(B<br><br>One$B%(%s%F%#%F%#(B<br>@ManyToOne<br>public OneTwo oneTwo;<br><br>Two$B%(%s%F%#%F%#(B<br>
@OneToOne(mappedBy = &quot;two&quot;)<br>public OneTwo oneTwo;<br>@OneToOne(mappedBy = &quot;two&quot;)<br>public TwoThree twoThree;<br><br>Three$B%(%s%F%#%F%#(B<br>@ManyToOne<br>public TwoThree twoThree;<br><br>OneTwo$B%(%s%F%#%F%#(B<br>@OneToOne<br>
public Two two;<br>@OneToMany(mappedBy = &quot;oneTwo&quot;)<br>public List&lt;One&gt; oneList;<br><br>TwoThree$B%(%s%F%#%F%#(B<br>@OneToOne<br>public Two two;<br>@OneToMany(mappedBy = &quot;twoThree&quot;)<br>public List&lt;Two&gt; twoList;<br>
<br>$B$=$7$F(BService$B%/%i%9$G0J2<$N$h$&$K(B<br>Two two = jdbcManager.from(Two.class).innerJoin(&quot;oneTwo&quot;).where(&quot;name = ?&quot;, &quot;two1&quot;).getSingleResult();<br>$B$9$k$H0U?^DL$j$N7k2L$,<hF@$G$-$^$9!#(B<br>$B$5$i$K%F!<%V%k$r7k9g$7$F(B<br>Two two = jdbcManager.from(Two.class).innerJoin(&quot;oneTwo&quot;).innerJoin(&quot;oneTwo.oneList&quot;).where(&quot;name = ?&quot;, &quot;two1&quot;).getSingleResult();<br>
$B$H$9$k$H0J2<%(%i!<$K$J$j$^$9!#(B<br>$B%(%s%F%#%F%#(B(One)$B$N%W%m%Q%F%#(B(oneTwo)$B$,IT@5$G$9!#(BJoinColumn$B$N(Bname$B$G;XDj$5$l$F$$$k30It%-!<(B(ONE_TWO_ID)$B$,B8:_$7$^$;$s!#(B<br>$B:G=*E*$KA4$F$N%F!<%V%k$r(BinnerJoin$B$7$?$$$N$G$9$,!"(B<br>$B$I$&$9$l$P$h$$$G$7$g$&$+!)(B<br><br>$B$h$m$7$/$*4j$$CW$7$^$9!#(B<br clear="all"><br>-- <br>conpota &lt;<a href="mailto:conpota@gmail.com">conpota@gmail.com</a>&gt;<br>

</div>