Hibernate seems to ignore where attribute in class mapping or I don't know how it is expected to work. Can someone hellp, please?
Details follow.
Hibernate version: 2.1.7
Mapping documents:
<class name="DrugDictionaryDrugName" table="DRUG_DICTIONARY" mutable="false" where="ACTIVE_FLAG='Y'">
<id name="drugNameId" type="long" length="10" column="DRUG_NAME_ID">
<generator class="assigned"/>
</id>
<property name="drugName" type="string" column="DRUG_NAME" length="200" />
<property name="genericName" type="string" column="INN_GENERIC_NAME" length="120" />
</class>
Code between sessionFactory.openSession() and session.close():
Criteria crit = session.createCriteria( DrugDictionaryDrugName.class );
if (drugName != null) {
drugName = DAOUtils.replaceWildChars( drugName );
crit.add( Expression.or( Expression.ilike( "drugName", drugName ), Expression.ilike( "genericName",
drugName ) ) );
}
//crit.setMaxResults(100);
list = crit.list();
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
Oracle 9
The generated SQL (show_sql=true):
select this.DRUG_NAME_ID as DRUG_NAM1_0_, this.DRUG_NAME as DRUG_NAME0_, this.INN_GENERIC_NAME as INN_GENE3_0_ from DRUG_DICTIONARY this where (lower(this.DRUG_NAME) like ? or lower(this.INN_GENERIC_NAME) like ?)
|