nhibernate-caches

How do I use Hibernate's second level cache with JPA?

拜拜、爱过 提交于 2019-12-13 11:43:35
问题 I am implementing an Entity Attribute Value based persistence mechanism. All DB access is done via Hibernate. I have a table that contains paths for nodes, it is extremely simple, just an id, and a path (string) The paths would be small in number, around a few thousand. The main table has millions of rows, and rather than repeating the paths, I've normalized the paths to their own table. The following is the behaviour I want, when inserting into main table 1) Check if the path exists in paths

NHibernate MemCached w/ Protobuf-net.Enyim — does it actually work?

谁说我不能喝 提交于 2019-12-11 04:09:11
问题 I've used the following assemblies to hook up NHibernate 2nd-level caching with Enyim Memcached using Protobuf-net binary serializer: NHibernate NHibernate.Caches.EnyimMemcached Enyim.Caching protobuf-net protobuf-net.Enyim It's recently come to my attention that despite hooking up protobuf-net with EnyimMemcached, I'm likely not actually using that serializer as all my entities were marked with just [Serializable] and neither [DataContract] or [ProtoContract] with corresponding ordered Data

How to make NHibernate considered property to always be dirty when using dynamic update or insert?

天大地大妈咪最大 提交于 2019-12-10 17:19:46
问题 I am looking for help on an issue with NHibernate which has been bugging me for a while now. Long story short: I’m looking for a way to, in the first level cache, “reset” a property on an entity each time I do an update or an insert. What I want to achieve is that the property in question will always be considered to be dirty by NHibernate when using dynamic update or insert. The backstory for this is that I know that, if the transaction was successful, the column that I want to “reset” will

NHibernate second-level caching - evicting regions

丶灬走出姿态 提交于 2019-11-30 21:33:26
We have a number of cache regions set up in our nHibernate implementation. In order to avoid trouble with load balanced web servers, I want to effectively disable the caching on the pages that edit the cached data. I can write a method that clears out all my query caches, my class caches and my entity caches easily enough. But what I really want is to clear the cache by region. sessionFactory.EvictQueries() will take a region parameter, but Evict() and EvictCollection() does not. I don't really want to throw away the whole cache here, nor do I want to maintain some sort of clumsy dictionary

NHibernate second-level caching - evicting regions

偶尔善良 提交于 2019-11-30 05:38:06
问题 We have a number of cache regions set up in our nHibernate implementation. In order to avoid trouble with load balanced web servers, I want to effectively disable the caching on the pages that edit the cached data. I can write a method that clears out all my query caches, my class caches and my entity caches easily enough. But what I really want is to clear the cache by region. sessionFactory.EvictQueries() will take a region parameter, but Evict() and EvictCollection() does not. I don't