3 Replies Latest reply on Apr 29, 2009 6:27 AM by Adam Warski

    Can I put two conditions in where attribute on the class ele

    Bikash Paul Newbie

      Hi,

      I'm new to this hibernate world. I'm writing one hibernate mapping file to fetch the data from a table(SUPS). But I want to put two conditions in where attribute on the class element.

      I want my hibernate mapping file should work as below SQL query:

      select SUPPLIER,SUP_NAME from SUPS where SUP_STATUS = 'A' and SUPPLIER_PARENT IS NULL;

      My Hibernate mapping file(SupplierImpl.hbm.xml):

      <?xml version="1.0"?>
      <!DOCTYPE hibernate-mapping PUBLIC
       "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
       "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
      
      <hibernate-mapping>
       <class name="com.retek.rpm.domain.core.bo.SupplierImpl" table="SUPS" mutable="false"
       where ="SUPPLIER_PARENT IS NULL">
       <composite-id name="objectId" class="com.retek.platform.bo.LongObjectId" access="field">
       <key-property name="value" column="SUPPLIER" type="long" access="field" />
       </composite-id>
       <property name="displayId" column="SUPPLIER" type="string" insert="false" update="false" access="field"/>
       <property name="name" column="SUP_NAME" type="string" insert="false" update="false" access="field"/>
       </class>
      </hibernate-mapping>


      I could put only one condition in the where attribute but couldn't find how I can put the other condition.I'm using Hibernate-Version: 2.1.7.

      Could you please guide me how I can put the other condition.

      Thanks,
      -Bikash