Select an entity using distinct keyword - hibernate - JPA getting 0 result

I’m using Hibernate 5.6.15 with JDK 11 LTS.

But I’m getting no results using the following code.

While there is a duplicate record in the database of the same ‘ransactionId’.
I’ve checked the list size which is 0.

public List<Orders> custOrder() {
        try ( Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.createQuery("select DISTINCT o from Orders o where o.transid = :transid", Orders.class)
                    .setParameter("transid", "tlrfx")
                    .setHint(QueryHints.HINT_PASS_DISTINCT_THROUGH, false)
                    .getResultList();
        }
    }

Maybe you are connecting to the wrong database or schema or use the wrong credentials?

Yeah, thank you.
I was passing the wrong parameter.
Have a nice time :slightly_smiling_face: