Search in sources :

Example 6 with Account

use of org.hibernate.test.cache.infinispan.functional.entities.Account in project hibernate-orm by hibernate.

the class AccountDAO method getAccountWithRefresh.

public Account getAccountWithRefresh(Integer id) throws Exception {
    return withTxSessionApply(useJta, sessionFactory, session -> {
        log.debug("Getting account " + id + " with refresh");
        Account acct = session.get(Account.class, id);
        session.refresh(acct);
        return session.get(Account.class, id);
    });
}
Also used : Account(org.hibernate.test.cache.infinispan.functional.entities.Account)

Example 7 with Account

use of org.hibernate.test.cache.infinispan.functional.entities.Account in project hibernate-orm by hibernate.

the class TimestampsRegionImplTest method testClearTimestampsRegionInIsolated.

public void testClearTimestampsRegionInIsolated() throws Exception {
    StandardServiceRegistryBuilder ssrb = createStandardServiceRegistryBuilder();
    final StandardServiceRegistry registry = ssrb.build();
    final StandardServiceRegistry registry2 = ssrb.build();
    try {
        final Properties properties = CacheTestUtil.toProperties(ssrb.getSettings());
        InfinispanRegionFactory regionFactory = CacheTestUtil.startRegionFactory(registry, getCacheTestSupport());
        InfinispanRegionFactory regionFactory2 = CacheTestUtil.startRegionFactory(registry2, getCacheTestSupport());
        TimestampsRegionImpl region = (TimestampsRegionImpl) regionFactory.buildTimestampsRegion(getStandardRegionName(REGION_PREFIX), properties);
        TimestampsRegionImpl region2 = (TimestampsRegionImpl) regionFactory2.buildTimestampsRegion(getStandardRegionName(REGION_PREFIX), properties);
        Account acct = new Account();
        acct.setAccountHolder(new AccountHolder());
        region.getCache().withFlags(Flag.FORCE_SYNCHRONOUS).put(acct, "boo");
    } finally {
        StandardServiceRegistryBuilder.destroy(registry);
        StandardServiceRegistryBuilder.destroy(registry2);
    }
}
Also used : TimestampsRegionImpl(org.hibernate.cache.infinispan.timestamp.TimestampsRegionImpl) Account(org.hibernate.test.cache.infinispan.functional.entities.Account) InfinispanRegionFactory(org.hibernate.cache.infinispan.InfinispanRegionFactory) TestInfinispanRegionFactory(org.hibernate.test.cache.infinispan.util.TestInfinispanRegionFactory) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) Properties(java.util.Properties) AccountHolder(org.hibernate.test.cache.infinispan.functional.entities.AccountHolder) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry)

Aggregations

Account (org.hibernate.test.cache.infinispan.functional.entities.Account)7 SessionFactory (org.hibernate.SessionFactory)2 AccountHolder (org.hibernate.test.cache.infinispan.functional.entities.AccountHolder)2 Iterator (java.util.Iterator)1 List (java.util.List)1 Properties (java.util.Properties)1 Query (org.hibernate.Query)1 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)1 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)1 InfinispanRegionFactory (org.hibernate.cache.infinispan.InfinispanRegionFactory)1 TimestampsRegionImpl (org.hibernate.cache.infinispan.timestamp.TimestampsRegionImpl)1 InfinispanMessageLogger (org.hibernate.cache.infinispan.util.InfinispanMessageLogger)1 TestInfinispanRegionFactory (org.hibernate.test.cache.infinispan.util.TestInfinispanRegionFactory)1 TxUtil.withTxSession (org.hibernate.test.cache.infinispan.util.TxUtil.withTxSession)1 TxUtil.withTxSessionApply (org.hibernate.test.cache.infinispan.util.TxUtil.withTxSessionApply)1 CacheContainer (org.infinispan.manager.CacheContainer)1 Test (org.junit.Test)1