-->
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.  [ 1 post ] 
Author Message
 Post subject: nvl Support in Hibernate Projections???
PostPosted: Tue Feb 21, 2006 4:58 am 
Newbie

Joined: Wed Feb 01, 2006 12:45 pm
Posts: 18
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

3.0

Mapping documents:

CertPalletsTrns.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.sitx.common.certinventory.dto.CertPalletsTrnsDTO" table="CERT_PALLETS_TRNS" >
<id name="cptSysNo" type="big_decimal">
<column name="CPT_SYS_NO" precision="22" scale="0" />
<generator class="assigned" />
</id>
<many-to-one name="RStateReasonCodes" class="com.sitx.common.certinventory.dto.RStateReasonCodesDTO" fetch="select">
<column name="CPT_STATUS_CODE" length="3" />
</many-to-one>
<many-to-one name="RLocationTypes" class="com.sitx.common.certinventory.dto.RLocationTypesDTO" fetch="select">
<column name="CPT_LOCATION_TO" length="9" />
</many-to-one>
<many-to-one name="RExceptions" class="com.sitx.common.certinventory.dto.RExceptionsDTO" fetch="select">
<column name="CPT_EXCEPTION_CODE" precision="22" scale="0" />
</many-to-one>
<many-to-one name="RStateReasonCodes_1" class="com.sitx.common.certinventory.dto.RStateReasonCodesDTO" fetch="select">
<column name="CPT_REASON_CODE" length="3" />
</many-to-one>
<many-to-one name="RLocationTypes_1" class="com.sitx.common.certinventory.dto.RLocationTypesDTO" fetch="select">
<column name="CPT_LOCATION_FROM" length="9" />
</many-to-one>
<many-to-one name="RCertTypes" class="com.sitx.common.certinventory.dto.RCertTypesDTO" fetch="select">
<column name="CPT_CERT_TYPE" length="3" />
</many-to-one>
<many-to-one name="certPallets" class="com.sitx.common.certinventory.dto.CertPalletsDTO" fetch="select">
<column name="CPT_PALLET_NO" length="14" />
</many-to-one>
<property name="cptRangeStartNo" type="big_decimal">
<column name="CPT_RANGE_START_NO" precision="22" scale="0" />
</property>
<property name="cptRangeEndNo" type="big_decimal">
<column name="CPT_RANGE_END_NO" precision="22" scale="0" />
</property>
<property name="cptCreateLogin" type="string">
<column name="CPT_CREATE_LOGIN" length="30" />
</property>
<property name="cptCreateDt" type="date">
<column name="CPT_CREATE_DT" length="7" />
</property>
<property name="cptUpdateLogin" type="string">
<column name="CPT_UPDATE_LOGIN" length="30" />
</property>
<property name="cptUpdateDt" type="date">
<column name="CPT_UPDATE_DT" length="7" />
</property>
<property name="cptComment" type="string">
<column name="CPT_COMMENT" length="80" />
</property>
<property name="cptUnfolded" type="string">
<column name="CPT_UNFOLDED" precision="22" scale="0" />
</property>
<property name="cptCovert" type="string">
<column name="CPT_COVERT" length="4" />
</property>
<property name="cptHeldForEvidence" type="string">
<column name="CPT_HELD_FOR_EVIDENCE" length="4" />
</property>

</class>
</hibernate-mapping>







Code between sessionFactory.openSession() and session.close():

First of all i what to know whether hibernate projections does support
"nvl()". I know that there is a NvlFunction() class is there. But how to make use of it to support nvl() in Oracle. For eg, this is my HQL.
How to convert this code in to hibernate projections with nvl support??


from CertPalletsTrnsDTO certPalletsTrns WHERE certPalletsTrns.certPallets.cpPalletNo='100' ORDER BY nvl(certPalletsTrns.cptUpdateDt,'01-jan-2001') DESC ;


This query actually displays the cptUpdateDt in the Descending order.
If the date field is null,then the null will come at the end(last) rather than
first(top). Like:-

cptUpdateDt
---------------
21/02/2006
20/01/2005
19/07/2004
null

Like this. Since i need the nvl() to check the condition of the date . I am
not able find a nvl() in hibernate projections. So, how to convert the
above query in to hibernate projections with nvl() support.
Please do provide a solution for this. I will be waiting for ur favourable
reply..


Name and version of the database you are using:

Oracle 9i



Thanks ,

HibernateCrazyLoverr


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

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.