[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5054) Add boolean Session.isDirty(Object)

Joachim Durchholz (JIRA) noreply at atlassian.com
Wed Mar 31 05:13:31 EDT 2010


Add boolean Session.isDirty(Object)
-----------------------------------

                 Key: HHH-5054
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5054
             Project: Hibernate Core
          Issue Type: New Feature
          Components: core
    Affects Versions: 3.3.2
         Environment: Irrelevant
            Reporter: Joachim Durchholz
            Priority: Critical


I need to check whether a given object is dirty.

Use case:
The application loads a large collection of objects, modifies a few of them, then loads the collection with another set of criteria, modifies another small subset, and so on; finally, it flushes everything to the database.
The code that loads the objects is separate from the code that does the modification. I.e. the load code does not have the knowledge about what objects got dirtied. Passing that knowledge from the modification code to the loader would create unwanted coupling, it would replicate knowledge that's already present in Hibernate, and it would be prone to bugs as the modification code would need to know what objects are attached to a session, and collect them in a Set<Object> of dirty objects.
With the proposed change, the loader can iterate over the objects in the collection, check their Session.isDirty(Object) status, and use Session.evict(Object) to reclaim the space used for clean objects.
(Note that this is really about keeping cache size under control. A way to keep the first-level cache size under control would serve my use case just as well, but such an API does not seem to exist, and I'd expect that to be far higher-hanging fruit than adding Session.evict(Object).)

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