[hibernate-issues] [Hibernate-JIRA] Created: (ANN-629) Eager ManyToOne relationship does not work using annotations

George Gastaldi (JIRA) noreply at atlassian.com
Fri Jun 29 17:04:52 EDT 2007


Eager ManyToOne relationship does not work using annotations
------------------------------------------------------------

                 Key: ANN-629
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-629
             Project: Hibernate Annotations
          Issue Type: Bug
    Affects Versions: 3.2.0.ga
         Environment: Oracle 10g environment. 
            Reporter: George Gastaldi
         Attachments: Entities.zip, hibernate.cfg.xml

The FetchMode.JOIN is not working for ManyToOne relationships.

Using:

session.createQuery("from OrigemVO obj").list();

produces:
 Hibernate: 
    select
        origemvo0_.CD_ORIGEM as CD1_1_,
        origemvo0_.VERSAO as VERSAO1_,
        origemvo0_.DT_ALTERACAO as DT3_1_,
        origemvo0_.NM_USUARIO as NM4_1_,
        origemvo0_.DS_ORIGEM as DS5_1_,
        origemvo0_.SG_UF as SG6_1_,
        origemvo0_.CD_JURISDICAO as CD9_1_,
        origemvo0_.COD_TST as COD7_1_,
        origemvo0_.COD_IBGE as COD8_1_ 
    from
        JCOMPANY.ORIGENS origemvo0_ 
    where
        origemvo0_.CD_ORIGEM=304

Hibernate: 
    select
        jurisdicao0_.CD_JURISDICAO as CD1_0_0_,
        jurisdicao0_.DS_JURISDICAO as DS2_0_0_ 
    from
        JCOMPANY.JURISDICAO jurisdicao0_ 
    where
        jurisdicao0_.CD_JURISDICAO=?

whether It should be:

    select
        this_.CD_ORIGEM as CD1_1_1_,
        this_.VERSAO as VERSAO1_1_,
        this_.DT_ALTERACAO as DT3_1_1_,
        this_.NM_USUARIO as NM4_1_1_,
        this_.DS_ORIGEM as DS5_1_1_,
        this_.SG_UF as SG6_1_1_,
        this_.CD_JURISDICAO as CD9_1_1_,
        this_.COD_TST as COD7_1_1_,
        this_.COD_IBGE as COD8_1_1_,
        jurisdicao2_.CD_JURISDICAO as CD1_0_0_,
        jurisdicao2_.DS_JURISDICAO as DS2_0_0_ 
    from
        JCOMPANY.ORIGENS this_ 
    inner join
        JCOMPANY.JURISDICAO jurisdicao2_ 
            on this_.CD_JURISDICAO=jurisdicao2_.CD_JURISDICAO

Classes and hibernate.cfg.xml attached.

It works when using:

session.createCriteria(OrigemVO.class).list();


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