| Galder Zamarreno It was not recorded. Radim Vansa, et.al. I went back and implemented the change to remove the txTimestamp argument that is passed in to SPI methods, where Session is also passed. I added a (temporary) Javadoc note on those methods about this being argument removed in favor of asking the Session. A few additional notes about this:
- I kept org.hibernate.cache.spi.RegionFactory#nextTimestamp as that is what is currently used to fuel the Session's timestamp value - which makes sense since the only real consumer of this is caching. So ORM will call this method every time a Session is created (to get its initial value) and then again every time a transaction is started.
- I also deprecated org.hibernate.engine.spi.SharedSessionContractImplementor#getTimestamp in favor of org.hibernate.engine.spi.SharedSessionContractImplementor#getTransactionStartTimestamp since I thought the latter more clearly implied its intent.
Additionally I started thinking about ways we could handle supplying the RegionFactory with information about the region names and whether any are repeated. The idea here is to allow building better CacheKeyFactory references. First I wanted to ask, conceptually, who we want being responsible for deciding which CacheKeyFactory to use, and how granularly we want to allow that be decided. My opinion is that the RegionFactory ought to be responsible for making this decision, but that we need to pass it better information for it to make that decision. To that end I propose the following changes to my branch:
/**
* Create a new "parameter object" for {@link RegionFactory#createRegion}
* (along with the region name)...
* <p/>
* This would be implemented by a local class during the building of the
* SessionFactory to build the RegionAccess for use by the EntityPersisters,
* CollectionPersisters, etc.
*/
public interface RegionBuildingContext {
/**
* The CacheKeyFactory specifically specified by the configuration of
* Hibernate i.e. by the user, by some "container", etc.
* <p/>
* RegionFactory implementors should use this to be its
* CacheKeyFactory when asked later.
*/
CacheKeyFactory getEnforcedCacheFactory();
/**
* Mapping of region-names we encountered when
* processing the user's mapping model.
* <p/>
* Radim, this is what I think helps with what you ask for regarding
* being given a mapping of region names to various types of
* being cached there. See RegionNameMapping contract below;
* this is what ORM would hand the RegionFactory when asking it
* to build a Region
*/
RegionNameMapping getRegionNameMapping();
}
/**
* Designed under the principle that each kind of "cacheable" can
* define only one AccessType. And that there is only one definition
* for entity hierarchies that must be defined under the root entity name.
*/
interface RegionNameMapping {
/**
* The user-defined values for all entities defined to be stored in
* this Region.
*/
List<EntityCacheDescriptor> getEntityCacheDescriptors();
List<CollectionCacheDescriptor> getCollectionDescriptors();
...
}
EntityCacheDescriptor etc were already on my branch, this just gives you access to them earlier so that you can make those decisions. |