Dencel wrote:
Help us to help you, please fill out the required information. I'll quess that the problem is in the date string you provided in the query. This is database dependent. Use named parameters in your query. Something like:
Code:
session.createQuery("...where issuedate=:date").setCalendar("date",Calendar.getInstance()).list();
Greetz
Hi Dencel,
Thanks for your response. I am using mySql DB for the query and it is working fine for most of the records but failing for only a few. Like max suggested in the the next mail, i am checking the data in the DB for any non null char(1) column to see if it has a null value.
Sarath.
PS: I am attaching the mapping files.
IssueBO
<!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.quadone.hms.inventory.businessobjects.IssueBO" table="inv_issue_header">
<id name="issueId" column="issue_id" type="long">
<generator class="increment"/>
</id>
<many-to-one class="com.quadone.hms.inventory.businessobjects.IndentBO" name="indentId" column="indent_id"/>
<property name="issueType" column="issue_type" type="string" length="5" not-null="true"/>
<property name="patientCode" column="patient_code" type="long"/>
<property name="patientName" column="patient_name" unique="true" length="60" type="string"/>
<property name="isCredit" column="is_credit" type="boolean"/>
<property name="age" column="age" type="float"/>
<property name="address" column="address" type="string" length="255" unique="true"/>
<property name="referralDoctor" column="referral_doctor" length="60" type="string"/>
<property name="issueDate" column="issue_date" type="date" not-null="true"/>
<!-- we have to add amount information and we have to remove remarks field in issueitembo mapping file -->
<property name="totalAmount" column="total_amount" type="float" not-null="true"/>
<property name="discountType" column="discount_type" type="string"/>
<property name="discountAmount" column="discount_amount" type="float"/>
<property name="tax" column="tax" type="float"/>
<property name="netAmount" column="net_amount" type="float" not-null="true"/>
<many-to-one class="com.quadone.hms.inventory.businessobjects.StockPointBO" name="fromStockPoint" column="from_stock_point_id"/>
<many-to-one class="com.quadone.hms.inventory.businessobjects.StockPointBO" name="toStockPoint" column="to_stock_point_id" not-null="true"/>
<set name="issueItems" cascade="all" order-by="issue_item_id asc">
<key column="issue_id"/>
<one-to-many class="com.quadone.hms.inventory.businessobjects.IssueItemBO"/>
</set>
<property name="remarks" column="remarks" type="string" length="255"/>
<property name="isCompletedIssue" column="is_completed_issued" type="char"/>
<property name="isActive" column="is_active" type="boolean"/>
</class>
</hibernate-mapping>
--------------------------------
IssueItemBO
<!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.quadone.hms.inventory.businessobjects.IssueItemBO" table="inv_issue_item">
<id name="issueItemId" column="issue_item_id" type="long">
<generator class="increment"/>
</id>
<many-to-one class="com.quadone.hms.inventory.businessobjects.IssueBO" name="issueId" column="issue_id"/>
<many-to-one class="com.quadone.hms.inventory.businessobjects.MaterialBO" name="mtrlId" column="mtrl_id"/>
<many-to-one class="com.quadone.hms.general.businessobjects.UomBO" name="uomId" column="uom_id"/>
<many-to-one class="com.quadone.hms.inventory.businessobjects.BatchBO" name="batchId" column="batch_id"/>
<property name="qty" column="qty" type="float"/>
<property name="issueprice" column="issueprice" type="float" not-null='true'/>
<property name="costtype" column="costtype" type="string"/>
<!-- <property name="remarks" column="remarks" type="string" length="255"/> -->
<property name="isIssued" column="is_issued" type="char"/>
<property name="isActive" column="is_active" type="boolean"/>
</class>
</hibernate-mapping>