[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5546) @Where and eager @ManyToMany makes em.find return null with Oracle9iDialect

Johan Andrén (JIRA) noreply at atlassian.com
Thu Sep 9 08:16:19 EDT 2010


@Where and eager @ManyToMany makes em.find return null with Oracle9iDialect
---------------------------------------------------------------------------

                 Key: HHH-5546
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5546
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.2.4.sp1
            Reporter: Johan Andrén
         Attachments: wherebug.tar.gz

A many-to-many relation between class A and class B is annotated with FetchType.EAGER and a @Where that limits what of the entries from table B that should be included depending on if property in B is null.


For HSQL it generates something like this
SELECT 
  A.*, A_TO_B.*, B.*
FROM 
  A
  LEFT OUTER JOIN A_TO_B ON A.id=A_TO_B.a_id
  LEFT OUTER JOIN B ON A_TO_B.b_id=B.id AND (B.SOME_PROPERTY IS NULL)
WHERE 
  A.id = ?

which works correctly, but for oracle9 we get this

SELECT 
  A.*, A_TO_B.*, B.*
FROM 
  A, A_TO_B, B
WHERE 
  A.id = A_TO_B.a_id(+)
  AND A_TO_B.b_id = B.id(+)
  AND ( B.SOME_PROPERTY IS NULL )
  AND calendar_event.id = ?
  

Which makes em.find(A.class, idForAnExistingA) return null if there only is Bs with someProperty=null in the database for the given A (no rows returned from the query). 


Not sure how to make a runnable testcase, attached a maven project with annotated classes and code that describes the steps to reproduce but is not runnable as is.

-- 
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