0

I want to select records from db by matching a Double value.

The code is as below:

String aQuery = "SELECT * FROM TableA WHERE field_a = :fieldA";

SQLQuery thisQuery = session.createSQLQuery(aQuery).addEntity(AClass.class);
thisQuery.setEntity("fieldA", aDoubleValue);

a.hbm.xml

<class name="AClass" table="a_table">
    <id name="id" column="id" type="pguuid" access="field">
        <generator class="identity" />
    </id>

    <property name="fieldA" column="field_a"type="double" />
    ....
</class>

Then got this issue org.hibernate.MappingException: Unknown entity: java.lang.Double

Any idea on how to fix it?

1 Answer 1

5

Aren't you supposed to use setParameter instead of setEntity?

thisQuery.setParameter("fieldA", aDoubleValue);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.