title: Hibernate query.uniqueResult() throws NonUniqueResultException, but the record is Unique
body: <p>I have a <code>Client</code> class, which is in one-to-many with <code>ClientCurrency</code> which is in one-to-one with <code>PaymentRule</code>.</p>
  
  <pre><code>  @Entity(name = "Client")
    public class Client{
      ...
       @OneToMany(mappedBy = "client")
       @Fetch(FetchMode.SELECT)
       @Cascade({CascadeType.ALL})
       public Set&lt;ClientCurrency&gt; getClientCurrencies() {
           return clientCurrencies;
       }
      }
  
    @Entity(name = "Client_Currency")
    public class ClientCurrency{
      @ManyToOne
      @JoinColumn(name = "client_id")
      public Client getClient() {
          return client;
      }
  
      @Column(name = "currency", length = 3)
      @Enumerated(EnumType.STRING)
      public Currency getCurrency() {
          return currency;
      }
      }
  </code></pre>
  
  <p>Where <code>Currency</code> - is Enum with some currencies.
  Now I'm trying to get a <code>ClientCurrency</code> with this method:</p>
  
  <pre><code>    public ClientCurrency get(Client client, Currency currency) {
          StringBuilder hql = new StringBuilder().append("FROM ")
                  .append(ClientCurrency.class.getName())
                  .append(" WHERE client = :client AND currency = :currency");
          Query query = getSessionFactory().getCurrentSession()
                  .createQuery(hql.toString()).setParameter("client", client)
                  .setParameter("currency", currency);
          return (ClientCurrency)query.uniqueResult();
      }
  </code></pre>
  
  <p>I know that the record is unique in database. I tried with <code>query.list()</code> and it returns two duplicates. Does anybody know what's going on?</p>