[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2548) when "order by" a composit object, which may be null, the result list returns only when the composit objcts not null

Ahmad Bawaneh (JIRA) noreply at atlassian.com
Sun Mar 11 09:44:48 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-2548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45907#comment-45907 ] 

Ahmad Bawaneh commented on HHH-2548:
------------------------------------

in a query in which i apply order by syntax that orders the returned list by a composite object i got the result without the null objects, lets say i have 10 items in the table 3 of them has null value for the order by column then the result is just 7 instead of 10, the column of the order by field is of type varchar ,or string for the entity.

> when "order by" a composit object, which may be null, the result list returns only when the composit objcts not null
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-2548
>                 URL: https://hibernate.onjira.com/browse/HHH-2548
>             Project: Hibernate ORM
>          Issue Type: Bug
>    Affects Versions: 3.2.3
>         Environment: tomcat 5.5, eclipse3.2, jre1.5, postgreSQL8.1, hibernate3 and hibernate3.2
>            Reporter: Yu Deng
>            Priority: Critical
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> <hibernate-mapping package="com.grapevinecs.ams.domain.perbranch.inv">
>     <class name="InvItem"> 
> 	      <id name="id" column="id">
>                   <generator class="hilo"/>
>               </id>
> 	...
>        <many-to-one name="transferredDetails"/> <!-- FK: Points to corresponding entry for transferred inventory items -->        
>         ....
> </class>
> (another mapping file)
> </hibernate-mapping>>
>     <hibernate-mapping package="com.grapevinecs.ams.domain.perbranch.inv">
>     <class name="InvTransferDetails" >
> 	    <id name="id" column="id">
>                 <generator class="hilo"/>
>             </id>
> 	    <property name="returnedToICBC" type="com.grapevinecs.ams.dao.BooleanInteger" not-null="true"/>
>             ...
>     </class>
> </hibernate-mapping>
> Probelm:
> 1)  The result returns 3000 records ----    select count(*)  from InvItem c  where upper(c.invType) LIKE '%D%' and c.invSeries.closed = '0' and c.branch =60551  order by c.transferredDetails.returnedToICBC asc,  c.stamp asc,c.invNmbr asc
> 2)  result List return size 0 by this query ---  from InvItem c  where upper(c.invType) LIKE '%D%' and c.invSeries.closed = '0' and c.branch =60551  order by c.transferredDetails.returnedToICBC asc,  c.stamp asc,c.invNmbr asc
> 1) is correct but 2) is not correct. only when transferredDetails in InvItem not null be returned. in case 2), I have no transferredDetails not null.
> after I excuted the query 2), even I remove "c.transferredDetails.returnedToICBC asc", the result is still return nothing.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list