当前位置: 首页>>代码示例>>Java>>正文


Java SynchronizationType类代码示例

本文整理汇总了Java中javax.persistence.SynchronizationType的典型用法代码示例。如果您正苦于以下问题:Java SynchronizationType类的具体用法?Java SynchronizationType怎么用?Java SynchronizationType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SynchronizationType类属于javax.persistence包,在下文中一共展示了SynchronizationType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JtaEntityManager

import javax.persistence.SynchronizationType; //导入依赖的package包/类
public JtaEntityManager(final String unitName, final JtaEntityManagerRegistry registry, final EntityManagerFactory entityManagerFactory,
                        final Map properties, final boolean extended, final String synchronizationType) {
    if (registry == null) {
        throw new NullPointerException("registry is null");
    }
    if (entityManagerFactory == null) {
        throw new NullPointerException("entityManagerFactory is null");
    }
    this.unitName = unitName;
    this.registry = registry;
    this.entityManagerFactory = entityManagerFactory;
    this.properties = properties;
    this.extended = extended;
    this.synchronizationType = !isJPA21(entityManagerFactory) || synchronizationType == null ?
            null : SynchronizationType.valueOf(synchronizationType.toUpperCase(Locale.ENGLISH));
    final String globalTimerConfig = SystemInstance.get().getProperty("openejb.jpa.timer");
    final Object localTimerConfig = properties == null ? null : properties.get("openejb.jpa.timer");
    this.timer = localTimerConfig == null ? (globalTimerConfig == null || Boolean.parseBoolean(globalTimerConfig)) : Boolean.parseBoolean(localTimerConfig.toString());
    logger = unitName == null ? baseLogger : baseLogger.getChildLogger(unitName);
    final String wrapConfig = ReloadableEntityManagerFactory.class.isInstance(entityManagerFactory) ?
            ReloadableEntityManagerFactory.class.cast(entityManagerFactory).getUnitProperties().getProperty("openejb.jpa.query.wrap-no-tx", "true") : "true";
    this.wrapNoTxQueries = wrapConfig == null || "true".equalsIgnoreCase(wrapConfig);
}
 
开发者ID:apache,项目名称:tomee,代码行数:24,代码来源:JtaEntityManager.java

示例2: DatabaseReadOnlyNetwork

import javax.persistence.SynchronizationType; //导入依赖的package包/类
public DatabaseReadOnlyNetwork(EntityManager entityManager, boolean isShortTerm) {
	super(new EntityManagerImpl(entityManager.unwrap(ServerSession.class), SynchronizationType.UNSYNCHRONIZED), isShortTerm);
	ServerSession server = entityManager.unwrap(ServerSession.class);
	if (!server.getProperties().containsKey("network")) {
		server.setProperty("network", this);
	}
}
 
开发者ID:BotLibre,项目名称:BotLibre,代码行数:8,代码来源:DatabaseReadOnlyNetwork.java

示例3: isJPA21

import javax.persistence.SynchronizationType; //导入依赖的package包/类
public static boolean isJPA21(final EntityManagerFactory entityManagerFactory) {
    return ReloadableEntityManagerFactory.class.isInstance(entityManagerFactory) ?
            hasMethod(
                    ReloadableEntityManagerFactory.class.cast(entityManagerFactory).getEntityManagerFactoryCallable().getProvider(),
                    "generateSchema", String.class, Map.class)
            : hasMethod(entityManagerFactory.getClass(), "createEntityManager", SynchronizationType.class);
}
 
开发者ID:apache,项目名称:tomee,代码行数:8,代码来源:JtaEntityManager.java

示例4: createEntityManager

import javax.persistence.SynchronizationType; //导入依赖的package包/类
@Override
public EntityManager createEntityManager(final SynchronizationType synchronizationType) {
    EntityManager em;
    try {
        em = delegate().createEntityManager(synchronizationType);
    } catch (final LinkageError le) {
        em = delegate.createEntityManager(synchronizationType);
    }

    if (logCriteriaJpql) {
        return new QueryLogEntityManager(em, logCriteriaJpqlLevel);
    }
    return em;
}
 
开发者ID:apache,项目名称:tomee,代码行数:15,代码来源:ReloadableEntityManagerFactory.java

示例5: createEntityManagers

import javax.persistence.SynchronizationType; //导入依赖的package包/类
private Index<EntityManagerFactory, JtaEntityManagerRegistry.EntityManagerTracker> createEntityManagers(final BeanContext beanContext) {
    // create the extended entity managers
    final Index<EntityManagerFactory, BeanContext.EntityManagerConfiguration> factories = beanContext.getExtendedEntityManagerFactories();
    Index<EntityManagerFactory, JtaEntityManagerRegistry.EntityManagerTracker> entityManagers = null;
    if (factories != null && factories.size() > 0) {
        entityManagers = new Index<>(new ArrayList<>(factories.keySet()));
        for (final Map.Entry<EntityManagerFactory, BeanContext.EntityManagerConfiguration> entry : factories.entrySet()) {
            final EntityManagerFactory entityManagerFactory = entry.getKey();

            JtaEntityManagerRegistry.EntityManagerTracker entityManagerTracker = entityManagerRegistry.getInheritedEntityManager(entityManagerFactory);
            final EntityManager entityManager;
            if (entityManagerTracker == null) {
                final Map properties = entry.getValue().getProperties();
                final SynchronizationType synchronizationType = entry.getValue().getSynchronizationType();
                if (synchronizationType != null) {
                    if (properties != null) {
                        entityManager = entityManagerFactory.createEntityManager(synchronizationType, properties);
                    } else {
                        entityManager = entityManagerFactory.createEntityManager(synchronizationType);
                    }
                } else if (properties != null) {
                    entityManager = entityManagerFactory.createEntityManager(properties);
                } else {
                    entityManager = entityManagerFactory.createEntityManager();
                }
                entityManagerTracker = new JtaEntityManagerRegistry.EntityManagerTracker(entityManager, synchronizationType != SynchronizationType.UNSYNCHRONIZED);
            } else {
                entityManagerTracker.incCounter();
            }
            entityManagers.put(entityManagerFactory, entityManagerTracker);
        }
    }
    return entityManagers;
}
 
开发者ID:apache,项目名称:tomee,代码行数:35,代码来源:StatefulContainer.java

示例6: createEntityManagers

import javax.persistence.SynchronizationType; //导入依赖的package包/类
private Index<EntityManagerFactory, JtaEntityManagerRegistry.EntityManagerTracker> createEntityManagers(final BeanContext beanContext) {
    // create the extended entity managers
    final Index<EntityManagerFactory, BeanContext.EntityManagerConfiguration> factories = beanContext.getExtendedEntityManagerFactories();
    Index<EntityManagerFactory, JtaEntityManagerRegistry.EntityManagerTracker> entityManagers = null;
    if (factories != null && factories.size() > 0) {
        entityManagers = new Index<EntityManagerFactory, JtaEntityManagerRegistry.EntityManagerTracker>(new ArrayList<EntityManagerFactory>(factories.keySet()));
        for (final Map.Entry<EntityManagerFactory, BeanContext.EntityManagerConfiguration> entry : factories.entrySet()) {
            final EntityManagerFactory entityManagerFactory = entry.getKey();

            JtaEntityManagerRegistry.EntityManagerTracker entityManagerTracker = entityManagerRegistry.getInheritedEntityManager(entityManagerFactory);
            final EntityManager entityManager;
            if (entityManagerTracker == null) {
                final SynchronizationType synchronizationType = entry.getValue().getSynchronizationType();
                final Map properties = entry.getValue().getProperties();
                if (synchronizationType != null) {
                    if (properties != null) {
                        entityManager = entityManagerFactory.createEntityManager(synchronizationType, properties);
                    } else {
                        entityManager = entityManagerFactory.createEntityManager(synchronizationType);
                    }
                } else if (properties != null) {
                    entityManager = entityManagerFactory.createEntityManager(properties);
                } else {
                    entityManager = entityManagerFactory.createEntityManager();
                }
                entityManagerTracker = new JtaEntityManagerRegistry.EntityManagerTracker(entityManager, synchronizationType != SynchronizationType.UNSYNCHRONIZED);
            } else {
                entityManagerTracker.incCounter();
            }
            entityManagers.put(entityManagerFactory, entityManagerTracker);
        }
    }
    return entityManagers;
}
 
开发者ID:apache,项目名称:tomee,代码行数:35,代码来源:ManagedContainer.java

示例7: persistenceContext

import javax.persistence.SynchronizationType; //导入依赖的package包/类
private InjectionPoint persistenceContext(String unitName) {
    final InjectionPoint ip = mock(InjectionPoint.class);
    final Annotated annotated = mock(Annotated.class);
    when(ip.getAnnotated()).thenReturn(annotated);
    final PersistenceContext annotation = new PersistenceContext() {
        @Override
        public Class<? extends Annotation> annotationType() {
            return null;
        }

        @Override
        public String name() {
            return null;
        }

        @Override
        public String unitName() {
            return unitName;
        }

        @Override
        public PersistenceContextType type() {
            return null;
        }

        @Override
        public SynchronizationType synchronization() {
            return null;
        }

        @Override
        public PersistenceProperty[] properties() {
            return new PersistenceProperty[0];
        }
    };
    when(annotated.getAnnotation(PersistenceContext.class)).thenReturn(annotation);
    return ip;
}
 
开发者ID:dajudge,项目名称:testee.fi,代码行数:39,代码来源:JpaInjectionServicesTest.java

示例8: createEntityManager

import javax.persistence.SynchronizationType; //导入依赖的package包/类
@Override
public EntityManager createEntityManager(SynchronizationType arg0) {
   EntityManager em = nativeEntityManagerFactory.createEntityManager(arg0);
   log.debug("create new CibetEntityManager with native " + em);
   return new CibetEntityManager(this, em, loadEager);
}
 
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:7,代码来源:CibetEntityManagerFactory.java

示例9: createEntityManager

import javax.persistence.SynchronizationType; //导入依赖的package包/类
@Override
public EntityManager createEntityManager(SynchronizationType synchronizationType) {
   return null;
}
 
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:5,代码来源:JdbcBridgeEntityManagerFactory.java

示例10: createEntityManager

import javax.persistence.SynchronizationType; //导入依赖的package包/类
public EntityManager createEntityManager(SynchronizationType type, Map properties) {
    return delegate.createEntityManager(type, properties);
}
 
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:4,代码来源:DelegatingEntityManagerFactory.java

示例11: createEntityManager

import javax.persistence.SynchronizationType; //导入依赖的package包/类
public SecureEntityManager createEntityManager(SynchronizationType synchronizationType, Map properties) {
    return createSecureEntityManager(super.createEntityManager(synchronizationType, properties), properties);
}
 
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:4,代码来源:SecureEntityManagerFactory.java

示例12: createEntityManager

import javax.persistence.SynchronizationType; //导入依赖的package包/类
@Override
public EntityManager createEntityManager(SynchronizationType arg0) {
    return null;
}
 
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:5,代码来源:MockitoPersistenceProvider.java

示例13: createEntityManager

import javax.persistence.SynchronizationType; //导入依赖的package包/类
public EntityManager createEntityManager(SynchronizationType st) {
    throw new UnsupportedOperationException("Not supported.");
}
 
开发者ID:victorrentea,项目名称:training,代码行数:4,代码来源:MockStockPriceEntityManagerFactory.java

示例14: PersistenceContextResourceFactory

import javax.persistence.SynchronizationType; //导入依赖的package包/类
public PersistenceContextResourceFactory(String unitName, EntityManagerFactory emf, TransactionType transactionType, SynchronizationType sync) {
    this.unitName = unitName;
    this.emf = emf;
    this.sync = sync;
    this.transactionType = transactionType;
}
 
开发者ID:kumuluz,项目名称:kumuluzee,代码行数:7,代码来源:PersistenceContextResourceFactory.java

示例15: getEntityManager

import javax.persistence.SynchronizationType; //导入依赖的package包/类
public static EntityManager getEntityManager(SynchronizationType st) {
	return emf.createEntityManager(st);
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:4,代码来源:TpEm.java


注:本文中的javax.persistence.SynchronizationType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。