You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Tomasz Prus <to...@gmail.com> on 2019/05/23 11:39:39 UTC

sessionFactory.getCache().evictCollectionData

Hello,
I have configured Ignite cache with Hibernate 2L cache for to instances and
almost everything works fine but when trying to evict collection data after
new entity creation, seems that eviction doesn't work because there is no
new entity in that evicted collection. My configs:

<bean id="transactional-cache"
class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
        <property name="cacheMode" value="REPLICATED"/>
        <property name="atomicityMode" value="TRANSACTIONAL"/>
        <property name="writeSynchronizationMode" value="FULL_SYNC"/>
        <property name="statisticsEnabled" value="true"/>
        <property name="nearConfiguration">
            <bean
class="org.apache.ignite.configuration.NearCacheConfiguration"/>
        </property>
    </bean>

    <bean id="igniteInstance"
class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="peerClassLoadingEnabled" value="true"/>
        <property name="igniteInstanceName" value="myGrid"/>
        <property name="cacheConfiguration"><list>
            <!--
                Configurations for entity caches.
            -->
            <bean parent="transactional-cache">
                <property name="name"
value="org.hibernate.cache.spi.UpdateTimestampsCache"/>
            </bean>

            <bean parent="transactional-cache">
                <property name="name"
value="org.hibernate.cache.internal.StandardQueryCache"/>
            </bean>
            <bean parent="transactional-cache">
                <property name="name" value="default-query-results-region"/>
            </bean>
            <bean parent="transactional-cache">
                <property name="name"
value="default-update-timestamps-region"/>
            </bean>

            <bean parent="transactional-cache">
                <property name="name" value="lock-cache"/>
            </bean>
            <bean parent="transactional-cache">
                <property name="name" value="query.ProjectDAO"/>
            </bean>
</list>
        </property>
        <property name="discoverySpi">
            <bean
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <property name="multicastGroup"
value="228.10.10.157"/>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
...
<bean id="dataSource" class = "com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
        <property name="driverClass"
value="${hibernate.connection.driver_class}" />
        <property name="jdbcUrl" value="${hibernate_connection_url}" />
        <property name="user" value="${hibernate.connection.username}" />
        <property name="password" value="${hibernate.connection.password}"
/>

        <!-- these are C3P0 properties -->
        <property name="acquireIncrement" value="2" />
        <property name="initialPoolSize" value="30" />
        <property name="minPoolSize" value="30" />
        <property name="maxPoolSize" value="50" />
        <property name="maxIdleTime" value="60" />

        <property name="acquireRetryAttempts" value="3" />
        <property name="acquireRetryDelay" value="3000" />

        <property name="idleConnectionTestPeriod" value="3600" />
        <property name="preferredTestQuery" value="SELECT 1 " />

        <property name="maxIdleTimeExcessConnections" value="3600" />
        <property name="maxConnectionAge" value="7200" />

        <property name="checkoutTimeout" value="50000" />

    </bean>

    <bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
depends-on="igniteInstance">

        <property name="dataSource">
            <ref bean="dataSource"/>
        </property>

        <property name="hibernateProperties">
            <props>
                <!--<prop key="hibernate.show_sql">true</prop>-->
                <prop
key="hibernate.session_factory_name">our-session-factory</prop>
                <prop
key="hibernate.session_factory_name_is_jndi">false</prop>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.generate_statistics">false</prop>
                <prop key="hibernate.connection.useUnicode">true</prop>
                <prop
key="hibernate.connection.characterEncoding">UTF-8</prop>
                <prop key="hibernate.cache.use_query_cache">true</prop>
                <prop
key="hibernate.cache.use_second_level_cache">true</prop>
                <prop
key="hibernate.cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</prop>
                <prop
key="org.apache.ignite.hibernate.default_access_type">READ_WRITE</prop>
                <prop
key="org.apache.ignite.hibernate.ignite_instance_name">myGrid</prop>
            </props>
        </property>

If i use only one instance (one application), eviction works fine. Can You
help me?

Re: sessionFactory.getCache().evictCollectionData

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Maybe Hibernate has its own cache (L1?) and it does not get evicted
synchronously. Unfortunately since you're using an unreleased module you
will have to debug it on your side, I guess. Maybe team up with module's
author.

Regards,
-- 
Ilya Kasnacheev


пн, 27 мая 2019 г. в 16:16, Tomasz Prus <to...@gmail.com>:

> We use Hibernate 5.3 i our application so I found on this forum, that I
> can build Ignite from source (master). Lastly I tried also with version
> 2.7.2 and Hibernate 4 but this wrong behavior still occurs.
> Everything works fine for one node but when we add the same cache
> configuration for second module in our application, new added objects are
> missing in Hibernate L2 cache in one of two nodes but exists in another (it
> happens randomly). It is interesting that if i run "evict" twice,
> everything works good. Maybe Hibernate evict doesn't work as expected our
> there is some fail between node-to-node communication? I don't think that
> could be an error in our application because I tried today with Hazelcast
> cache, and it worked.
>
> pon., 27 maj 2019 o 14:58 Ilya Kasnacheev <il...@gmail.com>
> napisał(a):
>
>> Hello!
>>
>> Don't see why it won't work for you from the first try. BTW, what's your
>> version? I ask because hibernate_5.3 is unreleased.
>>
>> Regards,
>> --
>> Ilya Kasnacheev
>>
>>
>> пн, 27 мая 2019 г. в 10:30, Tomasz Prus <to...@gmail.com>:
>>
>>> Any ideas?
>>>
>>> czw., 23 maj 2019 o 15:22 Tomasz Prus <to...@gmail.com> napisał(a):
>>>
>>>> Interestingly, when i run evictCollectionData twice, it works.
>>>>
>>>> czw., 23 maj 2019 o 13:39 Tomasz Prus <to...@gmail.com> napisał(a):
>>>>
>>>>> Hello,
>>>>> I have configured Ignite cache with Hibernate 2L cache for to
>>>>> instances and almost everything works fine but when trying to evict
>>>>> collection data after new entity creation, seems that eviction doesn't work
>>>>> because there is no new entity in that evicted collection. My configs:
>>>>>
>>>>> <bean id="transactional-cache"
>>>>> class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
>>>>>         <property name="cacheMode" value="REPLICATED"/>
>>>>>         <property name="atomicityMode" value="TRANSACTIONAL"/>
>>>>>         <property name="writeSynchronizationMode" value="FULL_SYNC"/>
>>>>>         <property name="statisticsEnabled" value="true"/>
>>>>>         <property name="nearConfiguration">
>>>>>             <bean
>>>>> class="org.apache.ignite.configuration.NearCacheConfiguration"/>
>>>>>         </property>
>>>>>     </bean>
>>>>>
>>>>>     <bean id="igniteInstance"
>>>>> class="org.apache.ignite.configuration.IgniteConfiguration">
>>>>>         <property name="peerClassLoadingEnabled" value="true"/>
>>>>>         <property name="igniteInstanceName" value="myGrid"/>
>>>>>         <property name="cacheConfiguration"><list>
>>>>>             <!--
>>>>>                 Configurations for entity caches.
>>>>>             -->
>>>>>             <bean parent="transactional-cache">
>>>>>                 <property name="name"
>>>>> value="org.hibernate.cache.spi.UpdateTimestampsCache"/>
>>>>>             </bean>
>>>>>
>>>>>             <bean parent="transactional-cache">
>>>>>                 <property name="name"
>>>>> value="org.hibernate.cache.internal.StandardQueryCache"/>
>>>>>             </bean>
>>>>>             <bean parent="transactional-cache">
>>>>>                 <property name="name"
>>>>> value="default-query-results-region"/>
>>>>>             </bean>
>>>>>             <bean parent="transactional-cache">
>>>>>                 <property name="name"
>>>>> value="default-update-timestamps-region"/>
>>>>>             </bean>
>>>>>
>>>>>             <bean parent="transactional-cache">
>>>>>                 <property name="name" value="lock-cache"/>
>>>>>             </bean>
>>>>>             <bean parent="transactional-cache">
>>>>>                 <property name="name" value="query.ProjectDAO"/>
>>>>>             </bean>
>>>>> </list>
>>>>>         </property>
>>>>>         <property name="discoverySpi">
>>>>>             <bean
>>>>> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>>>>>                 <property name="ipFinder">
>>>>>                     <bean
>>>>> class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
>>>>>                         <property name="multicastGroup"
>>>>> value="228.10.10.157"/>
>>>>>                     </bean>
>>>>>                 </property>
>>>>>             </bean>
>>>>>         </property>
>>>>>     </bean>
>>>>> ...
>>>>> <bean id="dataSource" class =
>>>>> "com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
>>>>>         <property name="driverClass"
>>>>> value="${hibernate.connection.driver_class}" />
>>>>>         <property name="jdbcUrl" value="${hibernate_connection_url}" />
>>>>>         <property name="user" value="${hibernate.connection.username}"
>>>>> />
>>>>>         <property name="password"
>>>>> value="${hibernate.connection.password}" />
>>>>>
>>>>>         <!-- these are C3P0 properties -->
>>>>>         <property name="acquireIncrement" value="2" />
>>>>>         <property name="initialPoolSize" value="30" />
>>>>>         <property name="minPoolSize" value="30" />
>>>>>         <property name="maxPoolSize" value="50" />
>>>>>         <property name="maxIdleTime" value="60" />
>>>>>
>>>>>         <property name="acquireRetryAttempts" value="3" />
>>>>>         <property name="acquireRetryDelay" value="3000" />
>>>>>
>>>>>         <property name="idleConnectionTestPeriod" value="3600" />
>>>>>         <property name="preferredTestQuery" value="SELECT 1 " />
>>>>>
>>>>>         <property name="maxIdleTimeExcessConnections" value="3600" />
>>>>>         <property name="maxConnectionAge" value="7200" />
>>>>>
>>>>>         <property name="checkoutTimeout" value="50000" />
>>>>>
>>>>>     </bean>
>>>>>
>>>>>     <bean id="sessionFactory"
>>>>> class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
>>>>> depends-on="igniteInstance">
>>>>>
>>>>>         <property name="dataSource">
>>>>>             <ref bean="dataSource"/>
>>>>>         </property>
>>>>>
>>>>>         <property name="hibernateProperties">
>>>>>             <props>
>>>>>                 <!--<prop key="hibernate.show_sql">true</prop>-->
>>>>>                 <prop
>>>>> key="hibernate.session_factory_name">our-session-factory</prop>
>>>>>                 <prop
>>>>> key="hibernate.session_factory_name_is_jndi">false</prop>
>>>>>                 <prop
>>>>> key="hibernate.dialect">${hibernate.dialect}</prop>
>>>>>                 <prop key="hibernate.generate_statistics">false</prop>
>>>>>                 <prop key="hibernate.connection.useUnicode">true</prop>
>>>>>                 <prop
>>>>> key="hibernate.connection.characterEncoding">UTF-8</prop>
>>>>>                 <prop key="hibernate.cache.use_query_cache">true</prop>
>>>>>                 <prop
>>>>> key="hibernate.cache.use_second_level_cache">true</prop>
>>>>>                 <prop
>>>>> key="hibernate.cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</prop>
>>>>>                 <prop
>>>>> key="org.apache.ignite.hibernate.default_access_type">READ_WRITE</prop>
>>>>>                 <prop
>>>>> key="org.apache.ignite.hibernate.ignite_instance_name">myGrid</prop>
>>>>>             </props>
>>>>>         </property>
>>>>>
>>>>> If i use only one instance (one application), eviction works fine. Can
>>>>> You help me?
>>>>>
>>>>

Re: sessionFactory.getCache().evictCollectionData

Posted by Tomasz Prus <to...@gmail.com>.
We use Hibernate 5.3 i our application so I found on this forum, that I can
build Ignite from source (master). Lastly I tried also with version 2.7.2
and Hibernate 4 but this wrong behavior still occurs.
Everything works fine for one node but when we add the same cache
configuration for second module in our application, new added objects are
missing in Hibernate L2 cache in one of two nodes but exists in another (it
happens randomly). It is interesting that if i run "evict" twice,
everything works good. Maybe Hibernate evict doesn't work as expected our
there is some fail between node-to-node communication? I don't think that
could be an error in our application because I tried today with Hazelcast
cache, and it worked.

pon., 27 maj 2019 o 14:58 Ilya Kasnacheev <il...@gmail.com>
napisał(a):

> Hello!
>
> Don't see why it won't work for you from the first try. BTW, what's your
> version? I ask because hibernate_5.3 is unreleased.
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> пн, 27 мая 2019 г. в 10:30, Tomasz Prus <to...@gmail.com>:
>
>> Any ideas?
>>
>> czw., 23 maj 2019 o 15:22 Tomasz Prus <to...@gmail.com> napisał(a):
>>
>>> Interestingly, when i run evictCollectionData twice, it works.
>>>
>>> czw., 23 maj 2019 o 13:39 Tomasz Prus <to...@gmail.com> napisał(a):
>>>
>>>> Hello,
>>>> I have configured Ignite cache with Hibernate 2L cache for to instances
>>>> and almost everything works fine but when trying to evict collection data
>>>> after new entity creation, seems that eviction doesn't work because there
>>>> is no new entity in that evicted collection. My configs:
>>>>
>>>> <bean id="transactional-cache"
>>>> class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
>>>>         <property name="cacheMode" value="REPLICATED"/>
>>>>         <property name="atomicityMode" value="TRANSACTIONAL"/>
>>>>         <property name="writeSynchronizationMode" value="FULL_SYNC"/>
>>>>         <property name="statisticsEnabled" value="true"/>
>>>>         <property name="nearConfiguration">
>>>>             <bean
>>>> class="org.apache.ignite.configuration.NearCacheConfiguration"/>
>>>>         </property>
>>>>     </bean>
>>>>
>>>>     <bean id="igniteInstance"
>>>> class="org.apache.ignite.configuration.IgniteConfiguration">
>>>>         <property name="peerClassLoadingEnabled" value="true"/>
>>>>         <property name="igniteInstanceName" value="myGrid"/>
>>>>         <property name="cacheConfiguration"><list>
>>>>             <!--
>>>>                 Configurations for entity caches.
>>>>             -->
>>>>             <bean parent="transactional-cache">
>>>>                 <property name="name"
>>>> value="org.hibernate.cache.spi.UpdateTimestampsCache"/>
>>>>             </bean>
>>>>
>>>>             <bean parent="transactional-cache">
>>>>                 <property name="name"
>>>> value="org.hibernate.cache.internal.StandardQueryCache"/>
>>>>             </bean>
>>>>             <bean parent="transactional-cache">
>>>>                 <property name="name"
>>>> value="default-query-results-region"/>
>>>>             </bean>
>>>>             <bean parent="transactional-cache">
>>>>                 <property name="name"
>>>> value="default-update-timestamps-region"/>
>>>>             </bean>
>>>>
>>>>             <bean parent="transactional-cache">
>>>>                 <property name="name" value="lock-cache"/>
>>>>             </bean>
>>>>             <bean parent="transactional-cache">
>>>>                 <property name="name" value="query.ProjectDAO"/>
>>>>             </bean>
>>>> </list>
>>>>         </property>
>>>>         <property name="discoverySpi">
>>>>             <bean
>>>> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>>>>                 <property name="ipFinder">
>>>>                     <bean
>>>> class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
>>>>                         <property name="multicastGroup"
>>>> value="228.10.10.157"/>
>>>>                     </bean>
>>>>                 </property>
>>>>             </bean>
>>>>         </property>
>>>>     </bean>
>>>> ...
>>>> <bean id="dataSource" class =
>>>> "com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
>>>>         <property name="driverClass"
>>>> value="${hibernate.connection.driver_class}" />
>>>>         <property name="jdbcUrl" value="${hibernate_connection_url}" />
>>>>         <property name="user" value="${hibernate.connection.username}"
>>>> />
>>>>         <property name="password"
>>>> value="${hibernate.connection.password}" />
>>>>
>>>>         <!-- these are C3P0 properties -->
>>>>         <property name="acquireIncrement" value="2" />
>>>>         <property name="initialPoolSize" value="30" />
>>>>         <property name="minPoolSize" value="30" />
>>>>         <property name="maxPoolSize" value="50" />
>>>>         <property name="maxIdleTime" value="60" />
>>>>
>>>>         <property name="acquireRetryAttempts" value="3" />
>>>>         <property name="acquireRetryDelay" value="3000" />
>>>>
>>>>         <property name="idleConnectionTestPeriod" value="3600" />
>>>>         <property name="preferredTestQuery" value="SELECT 1 " />
>>>>
>>>>         <property name="maxIdleTimeExcessConnections" value="3600" />
>>>>         <property name="maxConnectionAge" value="7200" />
>>>>
>>>>         <property name="checkoutTimeout" value="50000" />
>>>>
>>>>     </bean>
>>>>
>>>>     <bean id="sessionFactory"
>>>> class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
>>>> depends-on="igniteInstance">
>>>>
>>>>         <property name="dataSource">
>>>>             <ref bean="dataSource"/>
>>>>         </property>
>>>>
>>>>         <property name="hibernateProperties">
>>>>             <props>
>>>>                 <!--<prop key="hibernate.show_sql">true</prop>-->
>>>>                 <prop
>>>> key="hibernate.session_factory_name">our-session-factory</prop>
>>>>                 <prop
>>>> key="hibernate.session_factory_name_is_jndi">false</prop>
>>>>                 <prop
>>>> key="hibernate.dialect">${hibernate.dialect}</prop>
>>>>                 <prop key="hibernate.generate_statistics">false</prop>
>>>>                 <prop key="hibernate.connection.useUnicode">true</prop>
>>>>                 <prop
>>>> key="hibernate.connection.characterEncoding">UTF-8</prop>
>>>>                 <prop key="hibernate.cache.use_query_cache">true</prop>
>>>>                 <prop
>>>> key="hibernate.cache.use_second_level_cache">true</prop>
>>>>                 <prop
>>>> key="hibernate.cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</prop>
>>>>                 <prop
>>>> key="org.apache.ignite.hibernate.default_access_type">READ_WRITE</prop>
>>>>                 <prop
>>>> key="org.apache.ignite.hibernate.ignite_instance_name">myGrid</prop>
>>>>             </props>
>>>>         </property>
>>>>
>>>> If i use only one instance (one application), eviction works fine. Can
>>>> You help me?
>>>>
>>>

Re: sessionFactory.getCache().evictCollectionData

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Don't see why it won't work for you from the first try. BTW, what's your
version? I ask because hibernate_5.3 is unreleased.

Regards,
-- 
Ilya Kasnacheev


пн, 27 мая 2019 г. в 10:30, Tomasz Prus <to...@gmail.com>:

> Any ideas?
>
> czw., 23 maj 2019 o 15:22 Tomasz Prus <to...@gmail.com> napisał(a):
>
>> Interestingly, when i run evictCollectionData twice, it works.
>>
>> czw., 23 maj 2019 o 13:39 Tomasz Prus <to...@gmail.com> napisał(a):
>>
>>> Hello,
>>> I have configured Ignite cache with Hibernate 2L cache for to instances
>>> and almost everything works fine but when trying to evict collection data
>>> after new entity creation, seems that eviction doesn't work because there
>>> is no new entity in that evicted collection. My configs:
>>>
>>> <bean id="transactional-cache"
>>> class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
>>>         <property name="cacheMode" value="REPLICATED"/>
>>>         <property name="atomicityMode" value="TRANSACTIONAL"/>
>>>         <property name="writeSynchronizationMode" value="FULL_SYNC"/>
>>>         <property name="statisticsEnabled" value="true"/>
>>>         <property name="nearConfiguration">
>>>             <bean
>>> class="org.apache.ignite.configuration.NearCacheConfiguration"/>
>>>         </property>
>>>     </bean>
>>>
>>>     <bean id="igniteInstance"
>>> class="org.apache.ignite.configuration.IgniteConfiguration">
>>>         <property name="peerClassLoadingEnabled" value="true"/>
>>>         <property name="igniteInstanceName" value="myGrid"/>
>>>         <property name="cacheConfiguration"><list>
>>>             <!--
>>>                 Configurations for entity caches.
>>>             -->
>>>             <bean parent="transactional-cache">
>>>                 <property name="name"
>>> value="org.hibernate.cache.spi.UpdateTimestampsCache"/>
>>>             </bean>
>>>
>>>             <bean parent="transactional-cache">
>>>                 <property name="name"
>>> value="org.hibernate.cache.internal.StandardQueryCache"/>
>>>             </bean>
>>>             <bean parent="transactional-cache">
>>>                 <property name="name"
>>> value="default-query-results-region"/>
>>>             </bean>
>>>             <bean parent="transactional-cache">
>>>                 <property name="name"
>>> value="default-update-timestamps-region"/>
>>>             </bean>
>>>
>>>             <bean parent="transactional-cache">
>>>                 <property name="name" value="lock-cache"/>
>>>             </bean>
>>>             <bean parent="transactional-cache">
>>>                 <property name="name" value="query.ProjectDAO"/>
>>>             </bean>
>>> </list>
>>>         </property>
>>>         <property name="discoverySpi">
>>>             <bean
>>> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>>>                 <property name="ipFinder">
>>>                     <bean
>>> class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
>>>                         <property name="multicastGroup"
>>> value="228.10.10.157"/>
>>>                     </bean>
>>>                 </property>
>>>             </bean>
>>>         </property>
>>>     </bean>
>>> ...
>>> <bean id="dataSource" class =
>>> "com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
>>>         <property name="driverClass"
>>> value="${hibernate.connection.driver_class}" />
>>>         <property name="jdbcUrl" value="${hibernate_connection_url}" />
>>>         <property name="user" value="${hibernate.connection.username}" />
>>>         <property name="password"
>>> value="${hibernate.connection.password}" />
>>>
>>>         <!-- these are C3P0 properties -->
>>>         <property name="acquireIncrement" value="2" />
>>>         <property name="initialPoolSize" value="30" />
>>>         <property name="minPoolSize" value="30" />
>>>         <property name="maxPoolSize" value="50" />
>>>         <property name="maxIdleTime" value="60" />
>>>
>>>         <property name="acquireRetryAttempts" value="3" />
>>>         <property name="acquireRetryDelay" value="3000" />
>>>
>>>         <property name="idleConnectionTestPeriod" value="3600" />
>>>         <property name="preferredTestQuery" value="SELECT 1 " />
>>>
>>>         <property name="maxIdleTimeExcessConnections" value="3600" />
>>>         <property name="maxConnectionAge" value="7200" />
>>>
>>>         <property name="checkoutTimeout" value="50000" />
>>>
>>>     </bean>
>>>
>>>     <bean id="sessionFactory"
>>> class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
>>> depends-on="igniteInstance">
>>>
>>>         <property name="dataSource">
>>>             <ref bean="dataSource"/>
>>>         </property>
>>>
>>>         <property name="hibernateProperties">
>>>             <props>
>>>                 <!--<prop key="hibernate.show_sql">true</prop>-->
>>>                 <prop
>>> key="hibernate.session_factory_name">our-session-factory</prop>
>>>                 <prop
>>> key="hibernate.session_factory_name_is_jndi">false</prop>
>>>                 <prop key="hibernate.dialect">${hibernate.dialect}</prop>
>>>                 <prop key="hibernate.generate_statistics">false</prop>
>>>                 <prop key="hibernate.connection.useUnicode">true</prop>
>>>                 <prop
>>> key="hibernate.connection.characterEncoding">UTF-8</prop>
>>>                 <prop key="hibernate.cache.use_query_cache">true</prop>
>>>                 <prop
>>> key="hibernate.cache.use_second_level_cache">true</prop>
>>>                 <prop
>>> key="hibernate.cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</prop>
>>>                 <prop
>>> key="org.apache.ignite.hibernate.default_access_type">READ_WRITE</prop>
>>>                 <prop
>>> key="org.apache.ignite.hibernate.ignite_instance_name">myGrid</prop>
>>>             </props>
>>>         </property>
>>>
>>> If i use only one instance (one application), eviction works fine. Can
>>> You help me?
>>>
>>

Re: sessionFactory.getCache().evictCollectionData

Posted by Tomasz Prus <to...@gmail.com>.
Any ideas?

czw., 23 maj 2019 o 15:22 Tomasz Prus <to...@gmail.com> napisał(a):

> Interestingly, when i run evictCollectionData twice, it works.
>
> czw., 23 maj 2019 o 13:39 Tomasz Prus <to...@gmail.com> napisał(a):
>
>> Hello,
>> I have configured Ignite cache with Hibernate 2L cache for to instances
>> and almost everything works fine but when trying to evict collection data
>> after new entity creation, seems that eviction doesn't work because there
>> is no new entity in that evicted collection. My configs:
>>
>> <bean id="transactional-cache"
>> class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
>>         <property name="cacheMode" value="REPLICATED"/>
>>         <property name="atomicityMode" value="TRANSACTIONAL"/>
>>         <property name="writeSynchronizationMode" value="FULL_SYNC"/>
>>         <property name="statisticsEnabled" value="true"/>
>>         <property name="nearConfiguration">
>>             <bean
>> class="org.apache.ignite.configuration.NearCacheConfiguration"/>
>>         </property>
>>     </bean>
>>
>>     <bean id="igniteInstance"
>> class="org.apache.ignite.configuration.IgniteConfiguration">
>>         <property name="peerClassLoadingEnabled" value="true"/>
>>         <property name="igniteInstanceName" value="myGrid"/>
>>         <property name="cacheConfiguration"><list>
>>             <!--
>>                 Configurations for entity caches.
>>             -->
>>             <bean parent="transactional-cache">
>>                 <property name="name"
>> value="org.hibernate.cache.spi.UpdateTimestampsCache"/>
>>             </bean>
>>
>>             <bean parent="transactional-cache">
>>                 <property name="name"
>> value="org.hibernate.cache.internal.StandardQueryCache"/>
>>             </bean>
>>             <bean parent="transactional-cache">
>>                 <property name="name"
>> value="default-query-results-region"/>
>>             </bean>
>>             <bean parent="transactional-cache">
>>                 <property name="name"
>> value="default-update-timestamps-region"/>
>>             </bean>
>>
>>             <bean parent="transactional-cache">
>>                 <property name="name" value="lock-cache"/>
>>             </bean>
>>             <bean parent="transactional-cache">
>>                 <property name="name" value="query.ProjectDAO"/>
>>             </bean>
>> </list>
>>         </property>
>>         <property name="discoverySpi">
>>             <bean
>> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>>                 <property name="ipFinder">
>>                     <bean
>> class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
>>                         <property name="multicastGroup"
>> value="228.10.10.157"/>
>>                     </bean>
>>                 </property>
>>             </bean>
>>         </property>
>>     </bean>
>> ...
>> <bean id="dataSource" class = "com.mchange.v2.c3p0.ComboPooledDataSource"
>> destroy-method="close">
>>         <property name="driverClass"
>> value="${hibernate.connection.driver_class}" />
>>         <property name="jdbcUrl" value="${hibernate_connection_url}" />
>>         <property name="user" value="${hibernate.connection.username}" />
>>         <property name="password"
>> value="${hibernate.connection.password}" />
>>
>>         <!-- these are C3P0 properties -->
>>         <property name="acquireIncrement" value="2" />
>>         <property name="initialPoolSize" value="30" />
>>         <property name="minPoolSize" value="30" />
>>         <property name="maxPoolSize" value="50" />
>>         <property name="maxIdleTime" value="60" />
>>
>>         <property name="acquireRetryAttempts" value="3" />
>>         <property name="acquireRetryDelay" value="3000" />
>>
>>         <property name="idleConnectionTestPeriod" value="3600" />
>>         <property name="preferredTestQuery" value="SELECT 1 " />
>>
>>         <property name="maxIdleTimeExcessConnections" value="3600" />
>>         <property name="maxConnectionAge" value="7200" />
>>
>>         <property name="checkoutTimeout" value="50000" />
>>
>>     </bean>
>>
>>     <bean id="sessionFactory"
>> class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
>> depends-on="igniteInstance">
>>
>>         <property name="dataSource">
>>             <ref bean="dataSource"/>
>>         </property>
>>
>>         <property name="hibernateProperties">
>>             <props>
>>                 <!--<prop key="hibernate.show_sql">true</prop>-->
>>                 <prop
>> key="hibernate.session_factory_name">our-session-factory</prop>
>>                 <prop
>> key="hibernate.session_factory_name_is_jndi">false</prop>
>>                 <prop key="hibernate.dialect">${hibernate.dialect}</prop>
>>                 <prop key="hibernate.generate_statistics">false</prop>
>>                 <prop key="hibernate.connection.useUnicode">true</prop>
>>                 <prop
>> key="hibernate.connection.characterEncoding">UTF-8</prop>
>>                 <prop key="hibernate.cache.use_query_cache">true</prop>
>>                 <prop
>> key="hibernate.cache.use_second_level_cache">true</prop>
>>                 <prop
>> key="hibernate.cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</prop>
>>                 <prop
>> key="org.apache.ignite.hibernate.default_access_type">READ_WRITE</prop>
>>                 <prop
>> key="org.apache.ignite.hibernate.ignite_instance_name">myGrid</prop>
>>             </props>
>>         </property>
>>
>> If i use only one instance (one application), eviction works fine. Can
>> You help me?
>>
>

Re: sessionFactory.getCache().evictCollectionData

Posted by Tomasz Prus <to...@gmail.com>.
Interestingly, when i run evictCollectionData twice, it works.

czw., 23 maj 2019 o 13:39 Tomasz Prus <to...@gmail.com> napisał(a):

> Hello,
> I have configured Ignite cache with Hibernate 2L cache for to instances
> and almost everything works fine but when trying to evict collection data
> after new entity creation, seems that eviction doesn't work because there
> is no new entity in that evicted collection. My configs:
>
> <bean id="transactional-cache"
> class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
>         <property name="cacheMode" value="REPLICATED"/>
>         <property name="atomicityMode" value="TRANSACTIONAL"/>
>         <property name="writeSynchronizationMode" value="FULL_SYNC"/>
>         <property name="statisticsEnabled" value="true"/>
>         <property name="nearConfiguration">
>             <bean
> class="org.apache.ignite.configuration.NearCacheConfiguration"/>
>         </property>
>     </bean>
>
>     <bean id="igniteInstance"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>         <property name="peerClassLoadingEnabled" value="true"/>
>         <property name="igniteInstanceName" value="myGrid"/>
>         <property name="cacheConfiguration"><list>
>             <!--
>                 Configurations for entity caches.
>             -->
>             <bean parent="transactional-cache">
>                 <property name="name"
> value="org.hibernate.cache.spi.UpdateTimestampsCache"/>
>             </bean>
>
>             <bean parent="transactional-cache">
>                 <property name="name"
> value="org.hibernate.cache.internal.StandardQueryCache"/>
>             </bean>
>             <bean parent="transactional-cache">
>                 <property name="name"
> value="default-query-results-region"/>
>             </bean>
>             <bean parent="transactional-cache">
>                 <property name="name"
> value="default-update-timestamps-region"/>
>             </bean>
>
>             <bean parent="transactional-cache">
>                 <property name="name" value="lock-cache"/>
>             </bean>
>             <bean parent="transactional-cache">
>                 <property name="name" value="query.ProjectDAO"/>
>             </bean>
> </list>
>         </property>
>         <property name="discoverySpi">
>             <bean
> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>                 <property name="ipFinder">
>                     <bean
> class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
>                         <property name="multicastGroup"
> value="228.10.10.157"/>
>                     </bean>
>                 </property>
>             </bean>
>         </property>
>     </bean>
> ...
> <bean id="dataSource" class = "com.mchange.v2.c3p0.ComboPooledDataSource"
> destroy-method="close">
>         <property name="driverClass"
> value="${hibernate.connection.driver_class}" />
>         <property name="jdbcUrl" value="${hibernate_connection_url}" />
>         <property name="user" value="${hibernate.connection.username}" />
>         <property name="password" value="${hibernate.connection.password}"
> />
>
>         <!-- these are C3P0 properties -->
>         <property name="acquireIncrement" value="2" />
>         <property name="initialPoolSize" value="30" />
>         <property name="minPoolSize" value="30" />
>         <property name="maxPoolSize" value="50" />
>         <property name="maxIdleTime" value="60" />
>
>         <property name="acquireRetryAttempts" value="3" />
>         <property name="acquireRetryDelay" value="3000" />
>
>         <property name="idleConnectionTestPeriod" value="3600" />
>         <property name="preferredTestQuery" value="SELECT 1 " />
>
>         <property name="maxIdleTimeExcessConnections" value="3600" />
>         <property name="maxConnectionAge" value="7200" />
>
>         <property name="checkoutTimeout" value="50000" />
>
>     </bean>
>
>     <bean id="sessionFactory"
> class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
> depends-on="igniteInstance">
>
>         <property name="dataSource">
>             <ref bean="dataSource"/>
>         </property>
>
>         <property name="hibernateProperties">
>             <props>
>                 <!--<prop key="hibernate.show_sql">true</prop>-->
>                 <prop
> key="hibernate.session_factory_name">our-session-factory</prop>
>                 <prop
> key="hibernate.session_factory_name_is_jndi">false</prop>
>                 <prop key="hibernate.dialect">${hibernate.dialect}</prop>
>                 <prop key="hibernate.generate_statistics">false</prop>
>                 <prop key="hibernate.connection.useUnicode">true</prop>
>                 <prop
> key="hibernate.connection.characterEncoding">UTF-8</prop>
>                 <prop key="hibernate.cache.use_query_cache">true</prop>
>                 <prop
> key="hibernate.cache.use_second_level_cache">true</prop>
>                 <prop
> key="hibernate.cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</prop>
>                 <prop
> key="org.apache.ignite.hibernate.default_access_type">READ_WRITE</prop>
>                 <prop
> key="org.apache.ignite.hibernate.ignite_instance_name">myGrid</prop>
>             </props>
>         </property>
>
> If i use only one instance (one application), eviction works fine. Can You
> help me?
>