Hello,My application is using Hazelcast as a second level through it's JPA/Spring configuration file:<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
<property name="persistenceUnitName" value="MyApp" />
<property name="jpaProperties">
<props>
<prop key="hibernate.use_sql_comments">${jpa.vendor.sqlcomments}</prop>
<prop key="hibernate.generate_statistics">${jpa.vendor.generate.statistics}</prop>
<prop key="hibernate.archive.autodetection">class</prop>
<prop key="hibernate.cache.use_second_level_cache">${cache.use}</prop>
<prop key="hibernate.cache.provider_class">${cache.provider}</prop>
<prop key="hibernate.cache.use_query_cache">${cache.use.query}</prop>
<prop key="hibernate.cache.use_minimal_puts">${cache.use.minimal.puts}</prop>
<prop key="hibernate.cache.hazelcast.configuration_file_path">hazelcast-${cache.group.name}.xml</prop>
</props>
</property>
</bean>I also configure my distributed cache in my Spring config like so:<hz:hazelcast id="instance">....</hz:hazelcast><hz:hibernate-cache-provider id="cacheProvider" instance-ref="instance"/><hz:hibernate-region-factory id="regionFactory" instance-ref="instance"/>This creates two cache groups (one for the hibernate and one for the id="instance"). Is there a way to consolidate this into one? I noticed others requesting this capability and I wasn't sure how to check to see if it was ever implemented....thanks!--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
Visit this group at http://groups.google.com/group/hazelcast?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks, everything seems better, but I don't think the second level cache is working. I believe I have something configured wrong. I don't see any of my database entity classes in the startup log. I use to see the below at startup for each object:Jan 16, 2013 9:32:07 PM com.hazelcast.hibernate.provider.HazelcastCache
INFO: Creating new HazelcastCache with region name: com.api.model.WirelessCarrierI had to add the below constructor to the new RegionFactoryProxy class in order for the web app to start uppublic RegionFactoryProxy(final Properties properties) {
this();
}I removed the <property name="hibernate.cache.region.factory_class">com.hazelcast.hibernate.HazelcastCacheRegionFactory</property> from my entityManagerFactory bean's jpaProperties. Was that correct? Are any of the spring config's "hibernate..." jpaProperties even used with this JPA based implementation?Spring Config:
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
<property name="persistenceUnitName" value="Spot" />
<property name="jpaProperties"> <!-- these needed? -->
<props>
<prop key="hibernate.use_sql_comments">${jpa.vendor.sqlcomments}</prop>
<prop key="hibernate.generate_statistics">${jpa.vendor.generate.statistics}</prop>
<prop key="hibernate.archive.autodetection">class</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_minimal_puts">true</prop>
</props>
</property>
</bean>
<!-- my app's custom implemenetation of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter-->
<bean id="jpaVendorAdapter" class="myapp.api.service.impl.HibernateJpaVendorAdapter">
<property name="regionFactory" ref="regionFactory"/>
<property name="showSql" value="${jpa.vendor.showsql}" />
<property name="generateDdl" value="${jpa.vendor.generate.ddl}" />
<property name="databasePlatform" value="${jpa.vendor.dialect}" />
</bean>
<hz:hazelcast id="instance">
<hz:config>...</hz:config>
</hz:hazelcast>
<hz:hibernate-region-factory id="regionFactory" instance-ref="instance"/>