JPA entity from a table with non-unique id
<p>I want to have an entity</p>

<pre><code>class InkFormula {
    int id;
    Map&lt;Ink, Integer&gt; inkPercents;        
    ...
}
</code></pre>

<p>from a single table with such a structure:</p>

<pre><code>┌─────┬────────┬─────────┐
│ id  │ ink_id │ percent │
├─────┼────────┼─────────┤
│  1  │   1    │   50    │
├─────┼────────┼─────────┤
│  1  │   2    │   25    │
├─────┼────────┼─────────┤
│  1  │   3    │   0     │
├─────┼────────┼─────────┤
│  2  │   1    │   100   │
├─────┼────────┼─────────┤
│  2  │   2    │   80    │
└─────┴────────┴─────────┘
</code></pre>

<p>where non-unique <code>id</code> must be used to congregate a <code>Map&lt;&gt;</code> from <code>ink_id</code> and <code>percent</code>.</p>

<p>The reason why I need a single entity and a single table is a requirement to have unique constraint <code>id</code>, <code>ink_id</code> so that each formula could not contain repeated inks.</p>

<p>Is that possible with JPA and Hibernate?</p>