Note that there are some explanatory texts on larger screens.

plurals
  1. POHibernate example query incorrectly formed
    primarykey
    data
    text
    <p>User.hbm.xml</p> <pre><code>&lt;class name="dataAccess.User" table="USER" schema="PUBLIC" catalog="XYZ"&gt; &lt;id name="userId" type="long"&gt; &lt;column name="USER_ID" precision="10" scale="0" /&gt; &lt;generator class="assigned" /&gt; &lt;/id&gt; &lt;property name="userName" type="string"&gt; &lt;column name="USER_NAME" length="25" not-null="true" unique="true" /&gt; &lt;/property&gt; &lt;property name="emailId" type="string"&gt; &lt;column name="EMAIL_ID" length="50" not-null="true" /&gt; &lt;/property&gt; &lt;property name="password" type="string"&gt; &lt;column name="PASSWORD" length="50" not-null="true" /&gt; &lt;/property&gt; &lt;property name="admin" type="char"&gt; &lt;column name="ADMIN" length="1" not-null="true" /&gt; &lt;/property&gt; &lt;property name="lastLoginTime" type="timestamp"&gt; &lt;column name="LAST_LOGIN_TIME" length="23" /&gt; &lt;/property&gt; </code></pre> <p>My data access function</p> <pre><code>public List findByExample(User instance) { log.debug("finding User instance by example"); try { List results = sessionFactory.openSession() .createCriteria("dataAccess.User") .add(Example.create(instance)).list(); System.out.println(results.size()); log.debug("find by example successful, result size: " + results.size()); return results; } catch (RuntimeException re) { log.error("find by example failed", re); throw re; } } </code></pre> <p>I am only passing two out of the 6 attributes of the User class(username and password). But in the query it also checks for the admin field. It works fine if i put an exclude("admin") to the criteria. I cant quite figure out why this is happening. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload