[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HHH-7206) NaturalIdLoadAccess: NaturalId synchronization with no need to flush at all

Guenther Demetz (JIRA) noreply at atlassian.com
Thu Mar 29 05:13:48 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-7206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46114#comment-46114 ] 

Guenther Demetz edited comment on HHH-7206 at 3/29/12 4:13 AM:
---------------------------------------------------------------

Motivation:
Although documented nowhere, currently NaturalIdLoadAccess is working like query-apis, relying on flushes in order to get the context synchronized. This has some serious impacts on performance and functionality:

1. with session flushMode set to >= AUTO, *each* single naturalId-load-action
-  leads to all entities and collection beeing detected for changes (unless the persistent context is completely empty), 
     changes are enqueued to executions (flushEverythingToExecutions)
     
-  leads to executions being propagated to the database (performExecutions)
     if there is at least one action enqueued for concerning querySpace or if session flushMode is set to ALWAYS

  Thus performing many NaturalIdLoadAccesses within a medium-large sized context, has serious performance impacts!
  Furthermore on long-timed transactions flushes are problematic. The time-window between flush and final commit 
  easily become big enough to cause lock-waits or/and lock-timeouts on concurrent transactions.

2. by setting session flushMode to <= COMMIT, NaturalIdLoadAccess suddenly does not consider unflushed changes at all.
   Since not documented, this represents some lack in functionality.



      was (Author: pb00067):
    Motivation:
Although documented nowhere, currently NaturalIdLoadAccess is working like query-apis, relying on flushes in order to get the context synchronized. This has some serious impacts on performance and functionality:

*1. with session flushMode set to >= AUTO, *each* single naturalId-load-action
-  leads to all entities and collection beeing detected for changes (unless the persistent context is completely empty), 
     changes are enqueued to executions (flushEverythingToExecutions)
     
-  leads to executions being propagated to the database (performExecutions)
     if there is at least one action enqueued for concerning querySpace or if session flushMode is set to ALWAYS

  Thus performing many NaturalIdLoadAccesses within a medium-large sized context, has serious performance impacts!
  Furthermore on long-timed transactions flushes are problematic. The time-window between flush and final commit 
  easily become big enough to cause lock-waits or/and lock-timeouts on concurrent transactions.

*2. by setting session flushMode to <= COMMIT, NaturalIdLoadAccess suddenly does not consider unflushed changes at all.
   Since not documented, this represents some lack in functionality.


  
> NaturalIdLoadAccess: NaturalId synchronization with no need to flush at all
> ---------------------------------------------------------------------------
>
>                 Key: HHH-7206
>                 URL: https://hibernate.onjira.com/browse/HHH-7206
>             Project: Hibernate ORM
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 4.1.1
>         Environment: Hibernate4, database-independent
>            Reporter: Guenther Demetz
>              Labels: flush, naturalId
>
> With few code changes I think it is possible to make NaturalIdLoadAccess work with no need to rely on flush at all,
> please see following comments.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list