[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3882) inner join fetch + Filters + one-to-many + Extra null value

Sandeep Vaid (JIRA) noreply at atlassian.com
Tue Apr 28 03:44:17 EDT 2009


inner join fetch + Filters + one-to-many + Extra null value
-----------------------------------------------------------

                 Key: HHH-3882
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3882
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.3.1
            Reporter: Sandeep Vaid


Specify relationship in mapping using some condition not just id's.

 Say i have one-to-many relationship between Product and ProductNames
 Product ----> PID (PK)
 ProductNames------> PID, USECODE, STARTTIME as composite ID and ENDTIME is another normal column.
 
 Now i want to fetch product with PID='1' and USECODE='100' and STARTTIME < CURRENTTIME < ENDTIME.
 
 CURRENTTIME value will be known at runtime. 
 
  How to specify this in mapping and fetch Product & ProductNames using eager fetching?


ANS: Using Filters, this problem can be resolved. Define filter, attach filter and enable filter. Filter supports 
  specifying positional parameters value at runtime.
  but i got 1 problem with filters :
   Suppose i have 1 product with id as 100, it has 5 ProductNames..but when we apply filter only 2 productNames remains.
   
   When i use just "inner join fetch" with no filters, it returns me one Product object which contains List of productNames properly 
   populated.
   BUT When i use "select distinct product" and inner join fetch" with filter, it returns one product populated with productNames
   list which contains 3 elements viz. null, first filtered productName, second filtered productName..
   
   Why productNames list contains the first element as null? This seems to be a bug.. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list