Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.0.Beta3
    • Fix Version/s: 3.1.0
    • Component/s: Core
    • Labels:
      None

      Description

      Was "ICriteria/IQuery SetReadOnly"

      Right now the only way to keep specific objects from being flushed is to have two sessions, one of which does not auto-flush. Obviously this is clunky at best. Hibernate has a SetReadOnly method on ICriteria and IQuery that will keep objects returned by that query from being put into the persistence context and therefore being flushed. I'd go so far as to say that there should be some session setting that would prevent any readonly/immutable object from being flushed (as the only reason to flush them is to ensure they have not actually been changed) as well as having SetReadOnly for normally mutable objects that are being queried and used in a readonly way.

      http://forum.hibernate.org/viewtopic.php?p=2341430#2341430

        Activity

        Hide
        Devon Lazarus added a comment -

        I would like to make the case that the priority for this issue should be much higher. I also realize we're talking about an architectural issue and we should try and keep in line with the Hibernate product. However, allowing NH to iterate over hundreds if not thousands of immutable read-only objects in the persistence cache is a huge performance problem.

        There should be some method for us to configure an object to be cached in the second-level cache without having to dirty-check these types of objects. Immutable objects shouldn't be dirty-checked, imho. I'd rather not come up with my own wrapper as Harald suggests here:

        http://forum.hibernate.org/viewtopic.php?t=971241&highlight=immutable

        Show
        Devon Lazarus added a comment - I would like to make the case that the priority for this issue should be much higher. I also realize we're talking about an architectural issue and we should try and keep in line with the Hibernate product. However, allowing NH to iterate over hundreds if not thousands of immutable read-only objects in the persistence cache is a huge performance problem. There should be some method for us to configure an object to be cached in the second-level cache without having to dirty-check these types of objects. Immutable objects shouldn't be dirty-checked, imho. I'd rather not come up with my own wrapper as Harald suggests here: http://forum.hibernate.org/viewtopic.php?t=971241&highlight=immutable
        Show
        Fabio Maulo added a comment - Tolerant query cache http://fabiomaulo.blogspot.com/2009/04/tuning-nhibernate-tolerant-querycache.html
        Hide
        Julian Maughan added a comment -

        Created a feature branch called ReadOnlyCriteria and will begin committing a port of Hibernate's read-only ICriteria and IQuery capability that I started some months ago.

        Show
        Julian Maughan added a comment - Created a feature branch called ReadOnlyCriteria and will begin committing a port of Hibernate's read-only ICriteria and IQuery capability that I started some months ago.
        Hide
        Julian Maughan added a comment -

        The ReadOnlyEntities code branch has been merged into the trunk (see revision 5397) completing development on this new feature.

        Show
        Julian Maughan added a comment - The ReadOnlyEntities code branch has been merged into the trunk (see revision 5397) completing development on this new feature.

          People

          • Assignee:
            Unassigned
            Reporter:
            Aaron Jensen
          • Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Who's Looking?