[hibernate-issues] [Hibernate-JIRA] Resolved: (ANN-516) @OrderBy added to wrong table in inheritance relationship

Emmanuel Bernard (JIRA) noreply at atlassian.com
Tue Jan 16 19:41:44 EST 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-516?page=all ]
     
Emmanuel Bernard resolved ANN-516:
----------------------------------

    Fix Version: 3.2.2
     Resolution: Fixed
      Assign To: Emmanuel Bernard

Fixed, but sorta hacky

> @OrderBy added to wrong table in inheritance relationship
> ---------------------------------------------------------
>
>          Key: ANN-516
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-516
>      Project: Hibernate Annotations
>         Type: Bug

>     Versions: 3.2.1
>  Environment: Hibernate 3.2.1 GA release, 3.2.1 GA release for hibernate-annotations. Oracle database 10 Release 2.
>     Reporter: Martijn Reuvers
>     Assignee: Emmanuel Bernard
>      Fix For: 3.2.2
>  Attachments: orderby_testcase.zip
>
>
> Hi Emmanuel,
> As promised by John (I forgot my account so he filed the forum :/), hereby a working isolated testcase.
> It seems an invalid order-by clause is generated for an inheritance relationship in the following example-case:
> Person
> OrganisationUser (extends Person)
> Organisation has * OrganisationUsers
> The method in organisation:
>   @OneToMany (mappedBy="organisation",
>               fetch=FetchType.LAZY,
>               cascade={CascadeType.PERSIST,CascadeType.MERGE})
>   @OrderBy (value="firstName")             
>   public Set<OrganisationUser> getOrganisationUsers() {
>     return organisationUsers;
>   }
> The order-by attribute firstName is declared in Person, however the generated sql-query tries to order-by on the organisation-user table. Attached a fully working JDeveloper 10.1.3 project (zipped), if you want to use another IDE, just get the sources out of /database/src, /model/src and /test/src and you're good to go as well. I did not attach any libraries (as these are big), they were in the /libs/src directory, the libraries used to compile and run in that directory are:
> ant-antlr-1.6.5.jar
> antlr-2.7.6.jar
> asm-attrs.jar
> asm.jar
> cglib-2.1.3.jar
> commons-collections-2.1.1.jar
> commons-logging-1.0.4.jar
> dms.jar (oracle!)
> dom4j-1.6.1.jar
> ehcache-1.2.3.jar
> ejb3-persistence.jar
> hibernate-annotations.jar
> hibernate3.jar
> jta.jar
> ojdbc14dms.jar (oracle!)
> All are from the hibernate / hibernate annotations distribution releases, with the exception of oracle jdbc drivers. To get quickly started locate the: OrderByTest source file and hibernate.cfg.xml to change your connection, tables.sql contains a script you can directly run in Oracle to get the needed tables. 
> OrderByTest contains code to fill the tables with some test data and then runs the tests (see comments in OrderByTest).
> If you have questions, just let me know.
> Thanks!
> Martijn

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