Java 类javax.persistence.SharedCacheMode 实例源码

项目:devops-cstack    文件:DatabaseConfiguration.java   
@Bean
public EntityManagerFactory entityManagerFactory() {
    logger.debug("Configuring EntityManager");
    LocalContainerEntityManagerFactoryBean lcemfb = new LocalContainerEntityManagerFactoryBean();
    lcemfb.setPersistenceProvider(new HibernatePersistenceProvider());
    lcemfb.setPersistenceUnitName("persistenceUnit");
    lcemfb.setDataSource(dataSource());
    lcemfb.setJpaDialect(new HibernateJpaDialect());
    lcemfb.setJpaVendorAdapter(jpaVendorAdapter());
    lcemfb.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    Properties jpaProperties = new Properties();
    jpaProperties.put("hibernate.generate_statistics", false);
    jpaProperties.put("hibernate.show_sql", Boolean.parseBoolean(databaseShowSQL));
    lcemfb.setJpaProperties(jpaProperties);
    lcemfb.setPackagesToScan("cn.org.once.cstack.model");
    lcemfb.afterPropertiesSet();
    return lcemfb.getObject();
}
项目:devops-cstack    文件:DatabaseConfigurationTest.java   
@Bean
public EntityManagerFactory entityManagerFactory() {
    logger.debug("Configuring EntityManager");
    LocalContainerEntityManagerFactoryBean lcemfb = new LocalContainerEntityManagerFactoryBean();
    lcemfb.setPersistenceProvider(new HibernatePersistenceProvider());
    lcemfb.setPersistenceUnitName("persistenceUnit");
    lcemfb.setDataSource(dataSource());
    lcemfb.setJpaDialect(new HibernateJpaDialect());
    lcemfb.setJpaVendorAdapter(jpaVendorAdapter());
    lcemfb.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    Properties jpaProperties = new Properties();
    jpaProperties.put("hibernate.generate_statistics", true);
    jpaProperties.put("hibernate.show_sql", Boolean.parseBoolean(databaseShowSQL));
    lcemfb.setJpaProperties(jpaProperties);
    lcemfb.setPackagesToScan("cn.org.once.cstack.model");
    lcemfb.afterPropertiesSet();
    return lcemfb.getObject();
}
项目:bookManager    文件:RootApplicationContextConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
    Map<String, Object> properties = new Hashtable<>();
    properties.put("javax.persistence.schema-generation.database.action", "none");
    properties.put("hibernate.connection.characterEncoding", "utf8");
    properties.put("hibernate.connection.useUnicode", "true");
    properties.put("hibernate.connection.charSet", "utf8");
    properties.put("hibernate.search.default.directory_provider", "filesystem");
    properties.put("hibernate.search.default.indexBase", context.getInitParameter("indexDir"));

    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(adapter);
    factory.setDataSource(this.bookManagerDataSource());
    factory.setPackagesToScan("net.viperfish.bookManager");
    factory.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    factory.setValidationMode(ValidationMode.NONE);
    factory.setJpaPropertyMap(properties);
    return factory;
}
项目:devicehive-java-server    文件:RdbmsPersistenceConfig.java   
@Bean
@DependsOn(value = {"simpleApplicationContextHolder"})
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
    factoryBean.setDataSource(dataSource);
    factoryBean.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    factoryBean.setValidationMode(ValidationMode.CALLBACK);
    factoryBean.setJpaVendorAdapter(jpaVendorAdapter);
    factoryBean.setPackagesToScan("com.devicehive.model");

    final Properties props = new Properties();
    props.putAll(this.properties.getHibernateProperties(this.dataSource));
    if (useNativeClient) {
        props.put("hibernate.cache.hazelcast.native_client_group", groupName);
        props.put("hibernate.cache.hazelcast.native_client_password", groupPassword);
        if (!CollectionUtils.isEmpty(clusterMembers)) {
            props.put("hibernate.cache.hazelcast.native_client_address", clusterMembers.get(0));
        }
    }

    factoryBean.setJpaProperties(props);
    return factoryBean;
}
项目:aries-jpa    文件:JPAHandler.java   
@Override
public void endElement(String uri, String localName, String name) throws SAXException {
    String s = builder.toString().trim();
    // This step is VERY important, otherwise we pollute subsequent
    // elements
    builder = new StringBuilder();

    if ("".equals(s))
        return;

    PersistenceUnit pu = persistenceUnits.peek();

    if ("provider".equals(elementName))
        pu.setProviderClassName(s);
    else if ("jta-data-source".equals(elementName))
        pu.setJtaDataSourceName(s);
    else if ("non-jta-data-source".equals(elementName))
        pu.setNonJtaDataSourceName(s);
    else if ("class".equals(elementName))
        pu.addClassName(s);
    else if("mapping-file".equals(elementName))
        pu.addMappingFile(s);
    else if ("exclude-unlisted-classes".equals(elementName))
        pu.setExcludeUnlisted(Boolean.parseBoolean(s));
    else if ("shared-cache-mode".equals(elementName))
        pu.setSharedCacheMode(SharedCacheMode.valueOf(s));
    else if ("validation-mode".equals(elementName))
        pu.setValidationMode(ValidationMode.valueOf(s));
}
项目:lams    文件:AnnotationBinder.java   
private static Cache determineCacheSettings(XClass clazzToProcess, Mappings mappings) {
    Cache cacheAnn = clazzToProcess.getAnnotation( Cache.class );
    if ( cacheAnn != null ) {
        return cacheAnn;
    }

    Cacheable cacheableAnn = clazzToProcess.getAnnotation( Cacheable.class );
    SharedCacheMode mode = determineSharedCacheMode( mappings );
    switch ( mode ) {
        case ALL: {
            cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
            break;
        }
        case ENABLE_SELECTIVE: {
            if ( cacheableAnn != null && cacheableAnn.value() ) {
                cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
            }
            break;
        }
        case DISABLE_SELECTIVE: {
            if ( cacheableAnn == null || cacheableAnn.value() ) {
                cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
            }
            break;
        }
        default: {
            // treat both NONE and UNSPECIFIED the same
            break;
        }
    }
    return cacheAnn;
}
项目:Sound.je    文件:DatabaseConfig.java   
/**
 * Create new EntityManagerFactory
 *
 * @param dataSource          the data source
 * @param hibernateProperties the hibernate properties
 * @return the entity manager factory
 */
@Bean
public EntityManagerFactory entityManagerFactory(final DataSource dataSource, final Properties hibernateProperties) {
    final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource);
    em.setPackagesToScan(entitymanagerPackagesToScan);
    em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    em.setJpaProperties(hibernateProperties);
    em.setPersistenceUnitName("nestedbird");
    em.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    em.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    em.afterPropertiesSet();

    return em.getObject();
}
项目:amanda    文件:RootContextConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
    Map<String, Object> properties = new HashMap<>();
    // properties.put("javax.persistence.schema-generation.database.action", "none"); // 没有update选项,只有:none、create、drop-and-create、drop,不满足开发需求
    // properties.put("hibernate.hbm2ddl.auto", "update"); // 使用adapter.setGenerateDdl(true),避免拼写错误;
    properties.put("hibernate.ejb.use_class_enhancer", "true");
    properties.put("hibernate.search.default.directory_provider", "filesystem");
    properties.put("hibernate.search.lucene_version", "5.3.1"); // 避免控制台警告,默认使用LUCENE_CURRENT
    properties.put("hibernate.search.default.indexBase", "../amanda/searchIndexes");

    // properties.put("hibernate.show_sql", "true");
    // properties.put("hibernate.format_sql", "true");
    properties.put("hibernate.use_sql_comments", "true");
    properties.put("hibernate.physical_naming_strategy", "com.timeyang.amanda.core.jpa.naming.PhysicalNamingStrategyImpl");

    LocalContainerEntityManagerFactoryBean factory =
            new LocalContainerEntityManagerFactoryBean();
    factory.setDataSource(this.dataSource);
    factory.setJpaVendorAdapter(jpaVendorAdapter());
    factory.setPackagesToScan(AmandaApplication.class.getPackage().getName());
    factory.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    factory.setValidationMode(ValidationMode.NONE);
    factory.setLoadTimeWeaver(this.loadTimeWeaver()); // TODO: remove when SPR-10856 fixed
    factory.setJpaPropertyMap(properties);
    return factory;
}
项目:carbon    文件:DefaultPersistenceUnitInfo.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    // for develop
    return SharedCacheMode.NONE;
    // for production
    // return SharedCacheMode.ENABLE_SELECTIVE;
}
项目:jpasecurity    文件:SecurePersistenceProviderTest.java   
private PersistenceUnitInfo createPersistenceUnitInfo() {
    PersistenceUnitInfo persistenceUnitInfo = mock(PersistenceUnitInfo.class);
    when(persistenceUnitInfo.getPersistenceUnitRootUrl()).thenReturn(createPersistenceUnitRootUrl());
    when(persistenceUnitInfo.getPersistenceUnitName()).thenReturn("annotation-based-field-access");
    when(persistenceUnitInfo.getTransactionType())
        .thenReturn(PersistenceUnitTransactionType.RESOURCE_LOCAL);
    when(persistenceUnitInfo.getValidationMode()).thenReturn(ValidationMode.AUTO);
    when(persistenceUnitInfo.getSharedCacheMode()).thenReturn(SharedCacheMode.UNSPECIFIED);
    when(persistenceUnitInfo.getJtaDataSource()).thenReturn(null);
    when(persistenceUnitInfo.getNonJtaDataSource()).thenReturn(null);
    when(persistenceUnitInfo.getNewTempClassLoader()).thenReturn(null);
    when(persistenceUnitInfo.getMappingFileNames()).thenReturn(Collections.<String>emptyList());
    when(persistenceUnitInfo.getJarFileUrls()).thenReturn(Collections.<URL>emptyList());
    when(persistenceUnitInfo.getPersistenceProviderClassName())
        .thenReturn(SecurePersistenceProvider.class.getName());
    when(persistenceUnitInfo.getClassLoader())
        .thenReturn(Thread.currentThread().getContextClassLoader());
    when(persistenceUnitInfo.getManagedClassNames()).thenReturn(Arrays.asList(
        FieldAccessAnnotationTestBean.class.getName(),
        FieldAccessMapKey.class.getName(),
        FieldAccessMapValue.class.getName()
    ));
    when(persistenceUnitInfo.excludeUnlistedClasses()).thenReturn(true);
    Properties properties = new Properties();
    properties.put("org.jpasecurity.persistence.provider", "org.hibernate.ejb.HibernatePersistence");
    properties.put("org.jpasecurity.security.context",
                   "org.jpasecurity.security.authentication.TestSecurityContext");
    properties.put("org.jpasecurity.security.rules.provider",
                   "org.jpasecurity.security.rules.XmlAccessRulesProvider");
    properties.put("hibernate.hbm2ddl.auto", "create-drop");
    properties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
    properties.put("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
    properties.put("hibernate.connection.url", "jdbc:hsqldb:mem:test");
    properties.put("hibernate.connection.username", "sa");
    properties.put("hibernate.connection.password", "");
    when(persistenceUnitInfo.getProperties()).thenReturn(properties);
    return persistenceUnitInfo;
}
项目:LSChatServer    文件:ApplicationRootContext.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean()
        throws ConfigurationException, IOException {
    Map<String, Object> properties = new Hashtable<>();
    String indexPath = this.configuration().getString(GlobalConfig.INDEX_PATH);
    if (indexPath == null) {
        indexPath = GlobalConfig.INDEX_PATH_DEFAULT;
    }
    properties.put("javax.persistence.schema-generation.database.action", "none");
    properties.put("hibernate.connection.characterEncoding", "utf8");
    properties.put("hibernate.connection.useUnicode", "true");
    properties.put("hibernate.connection.charSet", "utf8");
    properties.put("hibernate.search.default.directory_provider", "filesystem");
    properties.put("hibernate.search.default.indexBase", indexPath);

    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(adapter);
    factory.setDataSource(this.chatDataSource());
    factory.setPackagesToScan("net.viperfish.chatapplication");
    factory.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    factory.setValidationMode(ValidationMode.NONE);
    factory.setJpaPropertyMap(properties);
    return factory;
}
项目:osgi.ee    文件:PersistenceUnitInfoImpl.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    if (definition.cachingType.isEmpty()) {
        return SharedCacheMode.UNSPECIFIED;
    }
    return SharedCacheMode.valueOf(definition.cachingType);
}
项目:wisdom-jdbc    文件:PersistenceUnitComponent.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    PersistenceUnitCachingType sharedCacheMode = persistenceUnitXml.getSharedCacheMode();
    if (sharedCacheMode == null) {
        return null;
    }

    return SharedCacheMode.valueOf(sharedCacheMode.name());
}
项目:saos    文件:PersistenceConfiguration.java   
@Bean
public EntityManagerFactory entityManagerFactory() {
   LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
   emf.setDataSource(dataSource());
   emf.setPackagesToScan(new String[] {"pl.edu.icm.saos.persistence"});
   emf.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
   HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
   emf.setJpaVendorAdapter(vendorAdapter);
   emf.setJpaProperties(hibernateProperties());
   emf.afterPropertiesSet();
   emf.setJpaDialect(new DefaultIsolationLevelJpaDialect());
   return emf.getObject();
}
项目:bundles    文件:PersistenceUnitInfoImpl.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    PersistenceUnitCachingType sharedCacheMode = persistenceUnitXml.getSharedCacheMode();
    if (sharedCacheMode == null)
        return null;

    return SharedCacheMode.valueOf(sharedCacheMode.name());
}
项目:debop4j    文件:JpaTestBase.java   
@Before
public void createFactory() throws MalformedURLException {
    GetterPersistenceUnitInfo info = new GetterPersistenceUnitInfo();
    info.setClassLoader(Thread.currentThread().getContextClassLoader());
    //we explicitly list them to avoid scanning
    info.setExcludeUnlistedClasses(true);
    info.setJtaDataSource(new NoopDatasource());
    List<String> classNames = new ArrayList<String>();
    for (Class<?> clazz : getEntities()) {
        classNames.add(clazz.getName());
    }
    info.setManagedClassNames(classNames);
    info.setNonJtaDataSource(null);
    info.setPersistenceProviderClassName(HibernateOgmPersistence.class.getName());
    info.setPersistenceUnitName("default");
    final URL persistenceUnitRootUrl = new File("").toURL();
    info.setPersistenceUnitRootUrl(persistenceUnitRootUrl);
    info.setPersistenceXMLSchemaVersion("2.0");
    info.setProperties(new Properties());
    info.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    info.setTransactionType(PersistenceUnitTransactionType.JTA);
    info.setValidationMode(ValidationMode.AUTO);
    info.getProperties().setProperty(Environment.JTA_PLATFORM,
                                     JBossStandAloneJtaPlatform.class.getName()
    );

    // MassIndexerFactoryIntegrator is defined at 4.3.0
    // info.getProperties().setProperty(MassIndexerFactoryIntegrator.MASS_INDEXER_FACTORY_CLASSNAME, OgmMassIndexerFactory.class.getName());
    for (Map.Entry<String, String> entry : TestHelper.getEnvironmentProperties().entrySet()) {
        info.getProperties().setProperty(entry.getKey(), entry.getValue());
    }
    refineInfo(info);

    factory = new HibernateOgmPersistence().createContainerEntityManagerFactory(info, Collections.EMPTY_MAP);
    transactionManager = extractJBossTransactionManager(factory);
}
项目:tomee    文件:ReloadableEntityManagerFactory.java   
public synchronized void setSharedCacheMode(final SharedCacheMode mode) {
    final PersistenceUnitInfoImpl info = entityManagerFactoryCallable.getUnitInfo();
    info.setSharedCacheMode(mode);

    final Properties properties = entityManagerFactoryCallable.getUnitInfo().getProperties();
    if (properties.containsKey(JAVAX_PERSISTENCE_SHARED_CACHE_MODE)) {
        properties.setProperty(JAVAX_PERSISTENCE_SHARED_CACHE_MODE, mode.name());
    }
}
项目:tomee    文件:ReloadableEntityManagerFactory.java   
@ManagedOperation
@Description("change the shared cache mode if possible (value is ok)")
public void setSharedCacheMode(final String value) {
    try {
        final String v = value.trim().toUpperCase();
        final SharedCacheMode mode = v.isEmpty() ? SharedCacheMode.UNSPECIFIED : SharedCacheMode.valueOf(v);
        reloadableEntityManagerFactory.setSharedCacheMode(mode);
    } catch (final Exception iae) {
        // ignored
    }
}
项目:osgi-jpa-container    文件:PersistenceUnitInfoImpl.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    String s = (String) parsedPersistenceUnit.getPersistenceXmlMetadata().get(
            ParsedPersistenceUnit.SHARED_CACHE_MODE);

    if (s == null) {
        return SharedCacheMode.UNSPECIFIED;
    } else {
        return SharedCacheMode.valueOf(s);
    }
}
项目:jipijapa    文件:HibernatePersistenceProviderAdaptor.java   
@Override
public void addProviderDependencies(PersistenceUnitMetadata pu) {
    final Properties properties = pu.getProperties();
    final String sharedCacheMode = properties.getProperty(SHARED_CACHE_MODE);

    if ( Classification.NONE.equals(platform.defaultCacheClassification())) {
        if (!SharedCacheMode.NONE.equals(pu.getSharedCacheMode())) {
            JPA_LOGGER.tracef("second level cache is not supported in platform, ignoring shared cache mode");
        }
        pu.setSharedCacheMode(SharedCacheMode.NONE);
    }
    // check if 2lc is explicitly disabled which takes precedence over other settings
    boolean sharedCacheDisabled = SharedCacheMode.NONE.equals(pu.getSharedCacheMode())
            ||
            NONE.equals(sharedCacheMode);

    if (!sharedCacheDisabled &&
            Boolean.parseBoolean(properties.getProperty(AvailableSettings.USE_SECOND_LEVEL_CACHE))
            ||
            (sharedCacheMode != null && (!NONE.equals(sharedCacheMode)))
            || (!SharedCacheMode.NONE.equals(pu.getSharedCacheMode()) && (!SharedCacheMode.UNSPECIFIED.equals(pu.getSharedCacheMode())))) {
        HibernateSecondLevelCache.addSecondLevelCacheDependencies(pu.getProperties(), pu.getScopedPersistenceUnitName());
        JPA_LOGGER.tracef("second level cache enabled for %s", pu.getScopedPersistenceUnitName());
    } else {
        JPA_LOGGER.tracef("second level cache disabled for %s, pu %s property = %s, pu.getSharedCacheMode = %s",
                pu.getScopedPersistenceUnitName(),
                SHARED_CACHE_MODE,
                sharedCacheMode,
                pu.getSharedCacheMode().toString());
    }
}
项目:jipijapa    文件:HibernatePersistenceProviderAdaptor.java   
@Override
public void addProviderDependencies(PersistenceUnitMetadata pu) {
    final Properties properties = pu.getProperties();
    final String sharedCacheMode = properties.getProperty(SHARED_CACHE_MODE);

    if ( Classification.NONE.equals(platform.defaultCacheClassification())) {
        if (!SharedCacheMode.NONE.equals(pu.getSharedCacheMode())) {
            JPA_LOGGER.tracef("second level cache is not supported in platform, ignoring shared cache mode");
        }
        pu.setSharedCacheMode(SharedCacheMode.NONE);
    }

    // check if 2lc is explicitly disabled which takes precedence over other settings
    boolean sharedCacheDisabled = SharedCacheMode.NONE.equals(pu.getSharedCacheMode())
            ||
            NONE.equals(sharedCacheMode);

    if (!sharedCacheDisabled &&
            Boolean.parseBoolean(properties.getProperty(AvailableSettings.USE_SECOND_LEVEL_CACHE))
            ||
            (sharedCacheMode != null && (!NONE.equals(sharedCacheMode)))
            || (!SharedCacheMode.NONE.equals(pu.getSharedCacheMode()) && (!SharedCacheMode.UNSPECIFIED.equals(pu.getSharedCacheMode())))) {
        HibernateSecondLevelCache.addSecondLevelCacheDependencies(pu.getProperties(), pu.getScopedPersistenceUnitName());
        JPA_LOGGER.tracef("second level cache enabled for %s", pu.getScopedPersistenceUnitName());
    } else {
        JPA_LOGGER.tracef("second level cache disabled for %s, pu %s property = %s, pu.getSharedCacheMode = %s",
                pu.getScopedPersistenceUnitName(),
                SHARED_CACHE_MODE,
                sharedCacheMode,
                pu.getSharedCacheMode().toString());
    }
}
项目:testee.fi    文件:PersistenceUnitInfoImpl.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return null;
}
项目:aries-jpa    文件:PersistenceUnit.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return this.sharedCacheMode;
}
项目:aries-jpa    文件:PersistenceUnit.java   
public void setSharedCacheMode(SharedCacheMode sharedCacheMode) {
    this.sharedCacheMode = sharedCacheMode;
}
项目:aries-jpa    文件:PersistenceUnitProxyWithTargetServer.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return delegate.getSharedCacheMode();
}
项目:lams    文件:PersistenceUnitReader.java   
/**
 * Parse the unit info DOM element.
 */
protected SpringPersistenceUnitInfo parsePersistenceUnitInfo(Element persistenceUnit, String version, URL rootUrl)
        throws IOException {

    SpringPersistenceUnitInfo unitInfo = new SpringPersistenceUnitInfo();

    // set JPA version (1.0 or 2.0)
    unitInfo.setPersistenceXMLSchemaVersion(version);

    // set persistence unit root URL
    unitInfo.setPersistenceUnitRootUrl(rootUrl);

    // set unit name
    unitInfo.setPersistenceUnitName(persistenceUnit.getAttribute(UNIT_NAME).trim());

    // set transaction type
    String txType = persistenceUnit.getAttribute(TRANSACTION_TYPE).trim();
    if (StringUtils.hasText(txType)) {
        unitInfo.setTransactionType(PersistenceUnitTransactionType.valueOf(txType));
    }

    // evaluate data sources
    String jtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, JTA_DATA_SOURCE);
    if (StringUtils.hasText(jtaDataSource)) {
        unitInfo.setJtaDataSource(this.dataSourceLookup.getDataSource(jtaDataSource.trim()));
    }

    String nonJtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, NON_JTA_DATA_SOURCE);
    if (StringUtils.hasText(nonJtaDataSource)) {
        unitInfo.setNonJtaDataSource(this.dataSourceLookup.getDataSource(nonJtaDataSource.trim()));
    }

    // provider
    String provider = DomUtils.getChildElementValueByTagName(persistenceUnit, PROVIDER);
    if (StringUtils.hasText(provider)) {
        unitInfo.setPersistenceProviderClassName(provider.trim());
    }

    // exclude unlisted classes
    Element excludeUnlistedClasses = DomUtils.getChildElementByTagName(persistenceUnit, EXCLUDE_UNLISTED_CLASSES);
    if (excludeUnlistedClasses != null) {
        String excludeText = DomUtils.getTextValue(excludeUnlistedClasses);
        unitInfo.setExcludeUnlistedClasses(!StringUtils.hasText(excludeText) || Boolean.valueOf(excludeText));
    }

    // set JPA 2.0 shared cache mode
    String cacheMode = DomUtils.getChildElementValueByTagName(persistenceUnit, SHARED_CACHE_MODE);
    if (StringUtils.hasText(cacheMode)) {
        unitInfo.setSharedCacheMode(SharedCacheMode.valueOf(cacheMode));
    }

    // set JPA 2.0 validation mode
    String validationMode = DomUtils.getChildElementValueByTagName(persistenceUnit, VALIDATION_MODE);
    if (StringUtils.hasText(validationMode)) {
        unitInfo.setValidationMode(ValidationMode.valueOf(validationMode));
    }

    parseProperties(persistenceUnit, unitInfo);
    parseManagedClasses(persistenceUnit, unitInfo);
    parseMappingFiles(persistenceUnit, unitInfo);
    parseJarFiles(persistenceUnit, unitInfo);

    return unitInfo;
}
项目:lams    文件:MutablePersistenceUnitInfo.java   
public void setSharedCacheMode(SharedCacheMode sharedCacheMode) {
    this.sharedCacheMode = sharedCacheMode;
}
项目:lams    文件:MutablePersistenceUnitInfo.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return this.sharedCacheMode;
}
项目:lams    文件:MetadataBuilderImpl.java   
@Override
public MetadataBuilder with(SharedCacheMode sharedCacheMode) {
    this.options.sharedCacheMode = sharedCacheMode;
    return this;
}
项目:lams    文件:MetadataBuilderImpl.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return sharedCacheMode;
}
项目:vertx-jpa    文件:DefaultPersistenceUnitInfoImpl.java   
public SharedCacheMode getSharedCacheMode() {
  return sharedCacheMode;
}
项目:vertx-jpa    文件:DefaultPersistenceUnitInfoImpl.java   
public void setSharedCacheMode(SharedCacheMode sharedCacheMode) {
  this.sharedCacheMode = sharedCacheMode;
}
项目:hibernate-types    文件:PersistenceUnitInfoImpl.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return SharedCacheMode.UNSPECIFIED;
}
项目:hibernate-types    文件:PersistenceUnitInfoImpl.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return SharedCacheMode.UNSPECIFIED;
}
项目:hibernate-types    文件:PersistenceUnitInfoImpl.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return SharedCacheMode.UNSPECIFIED;
}
项目:hibernate-types    文件:PersistenceUnitInfoImpl.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return SharedCacheMode.UNSPECIFIED;
}
项目:jk-db    文件:JKPersistenceUnitInfoImpl.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return SharedCacheMode.UNSPECIFIED;
}
项目:spring4-understanding    文件:PersistenceUnitReader.java   
/**
 * Parse the unit info DOM element.
 */
protected SpringPersistenceUnitInfo parsePersistenceUnitInfo(Element persistenceUnit, String version, URL rootUrl)
        throws IOException {

    SpringPersistenceUnitInfo unitInfo = new SpringPersistenceUnitInfo();

    // set JPA version (1.0 or 2.0)
    unitInfo.setPersistenceXMLSchemaVersion(version);

    // set persistence unit root URL
    unitInfo.setPersistenceUnitRootUrl(rootUrl);

    // set unit name
    unitInfo.setPersistenceUnitName(persistenceUnit.getAttribute(UNIT_NAME).trim());

    // set transaction type
    String txType = persistenceUnit.getAttribute(TRANSACTION_TYPE).trim();
    if (StringUtils.hasText(txType)) {
        unitInfo.setTransactionType(PersistenceUnitTransactionType.valueOf(txType));
    }

    // evaluate data sources
    String jtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, JTA_DATA_SOURCE);
    if (StringUtils.hasText(jtaDataSource)) {
        unitInfo.setJtaDataSource(this.dataSourceLookup.getDataSource(jtaDataSource.trim()));
    }

    String nonJtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, NON_JTA_DATA_SOURCE);
    if (StringUtils.hasText(nonJtaDataSource)) {
        unitInfo.setNonJtaDataSource(this.dataSourceLookup.getDataSource(nonJtaDataSource.trim()));
    }

    // provider
    String provider = DomUtils.getChildElementValueByTagName(persistenceUnit, PROVIDER);
    if (StringUtils.hasText(provider)) {
        unitInfo.setPersistenceProviderClassName(provider.trim());
    }

    // exclude unlisted classes
    Element excludeUnlistedClasses = DomUtils.getChildElementByTagName(persistenceUnit, EXCLUDE_UNLISTED_CLASSES);
    if (excludeUnlistedClasses != null) {
        String excludeText = DomUtils.getTextValue(excludeUnlistedClasses);
        unitInfo.setExcludeUnlistedClasses(!StringUtils.hasText(excludeText) || Boolean.valueOf(excludeText));
    }

    // set JPA 2.0 shared cache mode
    String cacheMode = DomUtils.getChildElementValueByTagName(persistenceUnit, SHARED_CACHE_MODE);
    if (StringUtils.hasText(cacheMode)) {
        unitInfo.setSharedCacheMode(SharedCacheMode.valueOf(cacheMode));
    }

    // set JPA 2.0 validation mode
    String validationMode = DomUtils.getChildElementValueByTagName(persistenceUnit, VALIDATION_MODE);
    if (StringUtils.hasText(validationMode)) {
        unitInfo.setValidationMode(ValidationMode.valueOf(validationMode));
    }

    parseProperties(persistenceUnit, unitInfo);
    parseManagedClasses(persistenceUnit, unitInfo);
    parseMappingFiles(persistenceUnit, unitInfo);
    parseJarFiles(persistenceUnit, unitInfo);

    return unitInfo;
}
项目:spring4-understanding    文件:MutablePersistenceUnitInfo.java   
public void setSharedCacheMode(SharedCacheMode sharedCacheMode) {
    this.sharedCacheMode = sharedCacheMode;
}
项目:spring4-understanding    文件:MutablePersistenceUnitInfo.java   
@Override
public SharedCacheMode getSharedCacheMode() {
    return this.sharedCacheMode;
}