[hibernate-issues] [Hibernate-JIRA] Created: (ANN-700) Hibernate's @NamedQuery always sets flushMode

Luke Maurer (JIRA) noreply at atlassian.com
Tue Mar 4 16:46:33 EST 2008


Hibernate's @NamedQuery always sets flushMode
---------------------------------------------

                 Key: ANN-700
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-700
             Project: Hibernate Annotations
          Issue Type: Bug
    Affects Versions: 3.3.0.ga
         Environment: Hibernate 3.2.4.sp1, MySQL 5
            Reporter: Luke Maurer


Hibernate's own @NamedQuery annotation (i.e. @org.hibernate.annotations.NamedQuery)'s flushMode attribute is AUTO by default. This tripped us up recently when we found that our Seam conversation-scoped persistence context (having MANUAL flush mode) was flushing prematurely. The problem is, though, no value of flushMode is going to be correct, as the query will elsewhere be used with flush mode AUTO.

The workaround is, of course, to set the flush mode every time we use the query, but this would be cumbersome and error-prone (and I suspect would defeat the point of being able to set it in the annotation in the first place). In our case, we didn't really need the extra stuff in the Hibernate extension, so we went back to the JPA @NamedQuery. At any rate, this is a very surprising (and subtle) side effect of merely switching from @javax.persistence.NamedQuery to @org.hibernate.annotations.NamedQuery.

(Unfortunately, I don't know a good solution, since, for what must be really great reasons, annotation elements can't have null values ...)

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