我的数据库是' postgresql'我正在使用Hibernate ORM。我有以下表格。
<h2>User Table</h2>
<table border='1'>
<th>User(PK)(varchar)</th>
<th>Password(varchar)</th>
<tr>
<td>John</td>
<td>password</td>
</tr>
<tr>
<td>James</td>
<td>password</td>
</tr>
<tr>
<td>Jenny</td>
<td>password</td>
</tr>
<tr>
<td>Helen</td>
<td>password</td>
</tr>
</table>
<br>
<h2>Role Table</h2>
<table border='1'>
<th>Role(PK)(varchar)</th>
<th>Description(varchar)</th>
<tr>
<td>PG</td>
<td>Programmer</td>
</tr>
<tr>
<td>SE</td>
<td>Software Engineer</td>
</tr>
<tr>
<td>TEST</td>
<td>Tester</td>
</tr>
<tr>
<td>TL</td>
<td>Team Leader</td>
</tr>
<tr>
<td>GM</td>
<td>General Manager</td>
</tr>
</table><br>
The two tables are joined into MANY TO MANY.
So dummy table is User_Role table.
<h2>User_Role Table</h2>
<table border='1'>
<th>User(FK)(varchar)</th>
<th>Role(FK)(varchar)</th>
<tr>
<td>John</td>
<td>PG</td>
</tr>
<tr>
<td>John</td>
<td>TEST</td>
</tr>
<tr>
<td>JENNY</td>
<td>SE</td>
</tr>
<tr>
<td>JENNY</td>
<td>TL</td>
</tr>
<tr>
<td>James</td>
<td>GM</td>
</tr>
</table>
&#13;
"from User_Role where role IN 'PG';"