[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-1570) criteria-api: filtering by key-many-to-one causes invalid sql

Hasan Ceylan (JIRA) noreply at atlassian.com
Wed Dec 26 13:29:06 EST 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hasan Ceylan updated HHH-1570:
------------------------------

    Attachment: hibernate.patch

First of all please ignore my previous comment.

Solution was rubbish and the workaround was partial.

Let me also congratulate the hibernate developers (to my knowledge) for the most comprehensive unit tested project.

As we moved into deployment phase in our project where we are heavily dependent on existing databases we have a lot of cases where the child class has composite primary key of which has Many-to-One relation with the parent.

I think missing the joins relies in trying to locate the joins only in properties but not in id fields.

Attached patch makes hibernate also go through the primary key fields in joins. I have put a lot of effort to make it up to the quality of hibernate. Nevertheless, it still has couple of tests failing. But this is like 7, as far as I remember. And given my schedule at least for now, I have no more time to go through them.

Hope to see the patch go main stream,

Regards,
Hasan Ceylan   

> criteria-api: filtering by key-many-to-one causes invalid sql
> -------------------------------------------------------------
>
>                 Key: HHH-1570
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1570
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: query-criteria
>    Affects Versions: 3.1.2
>            Reporter: Joris Verschoor
>         Attachments: hibernate.patch
>
>
> We have a class Price that has a composite-id using a couple of key-properties and some key-many-to-ones)
> One of those is "transportation", which has a many-to-one to transportationType
> When we query using: criteria.add(Expression.eq("price.transportation.transportationType.id", transId);, we get an invalid SQL statement: The table of transportation was not selected.
> I will try to make a testcase today or tomorrow, depending on my schedule.. Things will be more clear by then...
> We have created a work-around, by mapping the transportationID twice: once in key-property, and once as a many-to-one. (instead of one key-many-to-one)

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