-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Is where attribute in class mapping ignored?
PostPosted: Thu Mar 10, 2005 6:21 am 
Newbie

Joined: Thu Mar 10, 2005 6:17 am
Posts: 1
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 ?)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 10, 2005 7:07 am 
Senior
Senior

Joined: Sun Mar 14, 2004 10:16 am
Posts: 129
Location: Ankara
As far as I know, you should have an attribute in ur class for the column in where clause

<property name="activeFlag" column="ACTIVE_FLAG"/>

_________________
-developer


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.