[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3813) Automatic flush to the join table before a criteria query

Vitaliy S (JIRA) noreply at atlassian.com
Mon Jul 6 08:48:12 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33540#action_33540 ] 

Vitaliy S commented on HHH-3813:
--------------------------------

The original bug was discovered 3 years ago
There are at least 2 patches that fix this problem.
We tested Maxim's patch and it works fine. More over it looks much better than a patch provided in
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1195
Is hibernate team going to fix this bug in nearest future? 

> Automatic flush to the join table before a criteria query
> ---------------------------------------------------------
>
>                 Key: HHH-3813
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3813
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.1
>         Environment: Hibernate Core 3.3.1.GA, H2 1.1.108
>            Reporter: Maxim Gordienko
>         Attachments: criteriaflush.patch, criteriaflush.zip, CriteriaQueryTest.patch
>
>
> With the default flush mode Hibernate flushes query regions before queries to run SQL against actual table data.
> If two entity are connected using the join table and data is queried using a criteria Hibernate does not flush to the join table.
> It flushes to the entity tables though.
> The attached test case produces the SQL output
> Hibernate: insert into USERS (ID, NAME) values (null, ?)
> Hibernate: insert into ITEMS (ID, NAME) values (null, ?)
> Hibernate: select this_.ID as ID0_1_, this_.NAME as NAME0_1_, items3_.USER_ID as USER1_, items1_.ID as ITEM2_, items1_.ID as ID2_0_, items1_.NAME as NAME2_0_ from USERS this_ inner join USER_ITEMS items3_ on this_.ID=items3_.USER_ID inner join ITEMS items1_ on items3_.ITEM_ID=items1_.ID where items1_.NAME=?
> But it should flush to the USER_ITEMS table before executing the criteria query.
> The commented HQL query does flush to both the entity tables and the join table.
> The problem is in the org.hibernate.loader.criteria.CriteriaQueryTranslator.getQuerySpaces() method.
> It returns only the entity tables.

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