Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 5.0.6, 5.1.10
-
Component/s: hibernate-core
-
Labels:
-
Bug Testcase Reminder (view):
-
Last commented by a user?:true
-
Sprint:
Description
Test case:
- using Hibernate 5.0.6 with ehcache;
<?xml version="1.0" encoding="UTF-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ehcache.org/ehcache.xsd" updateCheck="false" monitoring="autodetect" dynamicConfig="true"> <cache name="configurationCache" eternal="false" timeToLiveSeconds="3600" maxEntriesLocalHeap="500"/> </ehcache>
- annotating the entity classes with @Cache
@Entity @Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE, region = "someConfigurationCache") public class SomeConfiguration implements Serializable { @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @JoinColumn(name = "some_configuration_id", referencedColumnName = "id") @Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE, region = "otherConfigurationCache") private List<OtherConfiguration> confList; }
- both "someConfigurationCache" and "otherConfigurationCache" are reused for entity and collection as well.
The result is "org.hibernate.cache.ehcache.internal.nonstop.NonstopAwareEntityRegionAccessStrategy cannot be cast to org.hibernate.cache.spi.access.CollectionRegionAccessStrategy", because the method determineCollectionRegionAccessStrategy in SessionFactoryImpl finds a region with the name required, but it is an entity region, not a collection region.
The same scenario works with 5.0.3.