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


Java PersistenceUnitProperties类代码示例

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


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

示例1: getJpaPropertyMap

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
@Override
public Map<String, Object> getJpaPropertyMap() {
	Map<String, Object> jpaProperties = new HashMap<String, Object>();

	if (getDatabasePlatform() != null) {
		jpaProperties.put(PersistenceUnitProperties.TARGET_DATABASE, getDatabasePlatform());
	}
	else if (getDatabase() != null) {
		String targetDatabase = determineTargetDatabaseName(getDatabase());
		if (targetDatabase != null) {
			jpaProperties.put(PersistenceUnitProperties.TARGET_DATABASE, targetDatabase);
		}
	}

	if (isGenerateDdl()) {
		jpaProperties.put(PersistenceUnitProperties.DDL_GENERATION,
				PersistenceUnitProperties.CREATE_ONLY);
		jpaProperties.put(PersistenceUnitProperties.DDL_GENERATION_MODE,
				PersistenceUnitProperties.DDL_DATABASE_GENERATION);
	}
	if (isShowSql()) {
		jpaProperties.put(PersistenceUnitProperties.LOGGING_LEVEL, Level.FINE.toString());
	}

	return jpaProperties;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:EclipseLinkJpaVendorAdapter.java

示例2: getEntityManagerFactory

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
/**
 * Returns the singleton EntityManagerFactory instance for accessing the
 * default database.
 * 
 * @return the singleton EntityManagerFactory instance
 * @throws NamingException
 *             if a naming exception occurs during initialization
 * @throws SQLException
 *             if a database occurs during initialization
 * @throws IOException 
 */
public static synchronized EntityManagerFactory getEntityManagerFactory()
		throws NamingException, SQLException, IOException {
	if (entityManagerFactory == null) {
		InitialContext ctx = new InitialContext();
	    BasicDataSource ds = new BasicDataSource();
	    JsonNode credentials = readCredentialsFromEnvironment();
		ds.setDriverClassName(credentials.get("driver").asText());
	    ds.setUrl(credentials.get("url").asText());
	    ds.setUsername(credentials.get("user").asText());
	    ds.setPassword(credentials.get("password").asText());
		Map<String, Object> properties = new HashMap<String, Object>();
		properties.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, ds);
		entityManagerFactory = Persistence.createEntityManagerFactory(
				PERSISTENCE_UNIT_NAME, properties);
	}
	return entityManagerFactory;
}
 
开发者ID:AnujMehta07,项目名称:cloud-employeeslistapp,代码行数:29,代码来源:JpaEntityManagerFactory.java

示例3: eclipseProperties

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
private Properties eclipseProperties(boolean fresh) {
    Properties properties = new Properties();
    properties.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT, "false");
    properties.put(PersistenceUnitProperties.WEAVING, "static");
    properties.put("eclipselink.logging.level.sql", "FINE");
    try {
        Class.forName("cz.encircled.joiner.eclipse.InheritanceJoiningSessionCustomizer");
        properties.put("eclipselink.session.customizer", "cz.encircled.joiner.eclipse.InheritanceJoiningSessionCustomizer");
    } catch (Exception e) {
        // ignore
    }
    if (fresh) {
        properties.put(PersistenceUnitProperties.DDL_GENERATION, "drop-and-create-tables");
    }
    return properties;
}
 
开发者ID:encircled,项目名称:Joiner,代码行数:17,代码来源:EntityManagerConfig.java

示例4: loadCustomJpaDefaults

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
/**
   * {@inheritDoc}
   */
  @Override
  protected void loadCustomJpaDefaults(Map<String, String> jpaProperties) {
if (getPersistenceUnitManager().getDefaultJtaDataSource() != null
		&& !jpaProperties.containsKey(PersistenceUnitProperties.TARGET_SERVER)) {
          jpaProperties.put(PersistenceUnitProperties.TARGET_SERVER, JtaTransactionController.class.getName());
      }

if (!jpaProperties.containsKey(PersistenceUnitProperties.SESSION_CUSTOMIZER)) {
	jpaProperties.put(PersistenceUnitProperties.SESSION_CUSTOMIZER, KradEclipseLinkCustomizer.class.getName());
}

if (!jpaProperties.containsKey(PersistenceUnitProperties.CACHE_SHARED_DEFAULT)) {
	jpaProperties.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT, "false");
}
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:KradEclipseLinkEntityManagerFactoryBean.java

示例5: getVendorProperties

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
@Override
protected Map<String, Object> getVendorProperties() {

    final Map<String, Object> properties = Maps.newHashMapWithExpectedSize(7);
    // Turn off dynamic weaving to disable LTW lookup in static weaving mode
    properties.put(PersistenceUnitProperties.WEAVING, "false");
    // needed for reports
    properties.put(PersistenceUnitProperties.ALLOW_NATIVE_SQL_QUERIES, "true");
    // flyway
    properties.put(PersistenceUnitProperties.DDL_GENERATION, "none");
    // Embeed into hawkBit logging
    properties.put(PersistenceUnitProperties.LOGGING_LOGGER, "JavaLogger");
    // Ensure that we flush only at the end of the transaction
    properties.put(PersistenceUnitProperties.PERSISTENCE_CONTEXT_FLUSH_MODE, "COMMIT");

    // Enable batch writing
    properties.put(PersistenceUnitProperties.BATCH_WRITING, "JDBC");
    // Batch size
    properties.put(PersistenceUnitProperties.BATCH_WRITING_SIZE, "500");

    return properties;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:23,代码来源:RepositoryApplicationConfiguration.java

示例6: deleteTenant

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
@Override
@Transactional
@Retryable(include = {
        ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public void deleteTenant(final String t) {
    final String tenant = t.toUpperCase();
    cacheManager.evictCaches(tenant);
    rolloutStatusCache.evictCaches(tenant);
    tenantAware.runAsTenant(tenant, () -> {
        entityManager.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, tenant);
        tenantMetaDataRepository.deleteByTenantIgnoreCase(tenant);
        tenantConfigurationRepository.deleteByTenant(tenant);
        targetRepository.deleteByTenant(tenant);
        targetFilterQueryRepository.deleteByTenant(tenant);
        rolloutRepository.deleteByTenant(tenant);
        targetTagRepository.deleteByTenant(tenant);
        distributionSetTagRepository.deleteByTenant(tenant);
        distributionSetRepository.deleteByTenant(tenant);
        distributionSetTypeRepository.deleteByTenant(tenant);
        softwareModuleRepository.deleteByTenant(tenant);
        artifactRepository.deleteByTenant(tenant);
        softwareModuleTypeRepository.deleteByTenant(tenant);
        return null;
    });
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:26,代码来源:JpaSystemManagement.java

示例7: _loadBBDDVendorProperties

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
private static Properties _loadBBDDVendorProperties(final DBSpec spec) {
	Properties props = new Properties();
	
	props.put(PersistenceUnitProperties.TARGET_DATABASE,spec.getVendor().getCode());	// MySQLPlatformExtension.class.getCanonicalName()		
	
	// used when generating schema 
	props.put(PersistenceUnitProperties.SCHEMA_DATABASE_PRODUCT_NAME,spec.getVendor().getCode());
	props.put(PersistenceUnitProperties.SCHEMA_DATABASE_MAJOR_VERSION,spec.getMajorVersion());
	props.put(PersistenceUnitProperties.SCHEMA_DATABASE_MINOR_VERSION,spec.getMinorVersion());
	
	// enable innoDB tables in MySql (needed for full-text searching)
	if (spec.getVendor().is(DBVendor.MySQL)) {
		props.put("eclipselink.ddl.default-table-suffix","engine=InnoDB");
	}
	
	return props;
}
 
开发者ID:opendata-euskadi,项目名称:r01fb,代码行数:18,代码来源:DBGuiceModuleBase.java

示例8: getEntityManagerFactory

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
/**
 * Returns the {@link EntityManagerFactory}.
 * 
 * @return The {@link EntityManagerFactory}
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
protected EntityManagerFactory getEntityManagerFactory()
{
	EntityManagerFactory retVal = null;
	
	try
	{
		Map properties = new HashMap();
		
		DataSource ds = this.getDataSource();
		
        properties.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, ds);
        
        retVal = Persistence.createEntityManagerFactory("application", properties);
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
	}
	
	return retVal;
}
 
开发者ID:SAP,项目名称:cloud-weatherapp,代码行数:28,代码来源:FavoriteCityService.java

示例9: init

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
private void init() {

		DataSource ds;
		try {

			InitialContext ctx = new InitialContext();
			ds = (DataSource) ctx.lookup(DATA_SOURCE);

			Map<String, DataSource> properties = new HashMap<>();
			properties.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, ds);
			setFactory(Persistence.createEntityManagerFactory(APPLICATION_NAME, properties));

		} catch (NamingException e) {

			LOGGER.error(ERROR_DATA_SOURCE_INITIALIZATION_FAILED_MESSAGE, e);
			throw new RuntimeException(ERROR_DATA_SOURCE_INITIALIZATION_FAILED_MESSAGE);
		}
	}
 
开发者ID:svilenkomitov,项目名称:Food-Calculator,代码行数:19,代码来源:EntityManagerProvider.java

示例10: save

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
public Configuration save(WriteContext ctx, Configuration configuration) throws Exception {
    EntityManager em = emf.createEntityManager();
    em.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, ctx.getTenant());

    byte[] key = new byte[32];
    secureRandom.nextBytes(key);
    em.setProperty("key", key);

    byte[] encryptedKey = AsymmetricEncryptionUtils.encrypt(key, ctx.getPublicKey());
    configuration.setKey(encryptedKey);

    em.getTransaction().begin();
    Configuration newConfiguration = em.merge(configuration);
    em.getTransaction().commit();

    return newConfiguration;
}
 
开发者ID:lukaszbudnik,项目名称:eclipselink-multitenant,代码行数:18,代码来源:ConfigurationDao.java

示例11: findByName

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
public Optional<Configuration> findByName(ReadContext ctx, String name) {
    EntityManager em = emf.createEntityManager();
    em.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, ctx.getTenant());
    em.setProperty("private-key", ctx.getPrivateKey());

    CriteriaBuilder cb = em.getCriteriaBuilder();

    CriteriaQuery<Configuration> q = cb.createQuery(Configuration.class);
    Root<Configuration> c = q.from(Configuration.class);
    ParameterExpression<String> p = cb.parameter(String.class);
    q.select(c).where(cb.equal(c.get("name"), p));

    TypedQuery<Configuration> query = em.createQuery(q);
    query.setParameter(p, name);

    Configuration configuration = query.getSingleResult();

    return Optional.ofNullable(configuration);
}
 
开发者ID:lukaszbudnik,项目名称:eclipselink-multitenant,代码行数:20,代码来源:ConfigurationDao.java

示例12: newEntityManagerFactory

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
/**
 * Constructs new entity manager factory.
 *
 * @param persistenceUnit the persistence unit
 * @param propertiesCategory the properties category
 * @return the new entity manager factory.
 */
private static EntityManagerFactory newEntityManagerFactory(String persistenceUnit, String propertiesCategory) {
    final Map properties = new HashMap();
    properties.put(PersistenceUnitProperties.JDBC_DRIVER, PropertiesUtil.getProperty(
            propertiesCategory, PersistenceUnitProperties.JDBC_DRIVER));
    properties.put(PersistenceUnitProperties.JDBC_URL, PropertiesUtil.getProperty(
            propertiesCategory, PersistenceUnitProperties.JDBC_URL));
    properties.put(PersistenceUnitProperties.JDBC_USER, PropertiesUtil.getProperty(
            propertiesCategory, PersistenceUnitProperties.JDBC_USER));
    properties.put(PersistenceUnitProperties.JDBC_PASSWORD, PropertiesUtil.getProperty(
            propertiesCategory, PersistenceUnitProperties.JDBC_PASSWORD));
    properties.put(PersistenceUnitProperties.DDL_GENERATION, PropertiesUtil.getProperty(
            propertiesCategory, PersistenceUnitProperties.DDL_GENERATION));

    return Persistence.createEntityManagerFactory(
            persistenceUnit, properties);
}
 
开发者ID:bubblecloud,项目名称:ilves,代码行数:24,代码来源:PersistenceUtil.java

示例13: buildCfg

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
private Map<String, Object> buildCfg()
{
    final Map<String, Object> cfg = new TreeMap<>();
    
    cfg.put(PersistenceUnitProperties.SCHEMA_GENERATION_DATABASE_ACTION, PersistenceUnitProperties.SCHEMA_GENERATION_NONE_ACTION);
    cfg.put(PersistenceUnitProperties.SCHEMA_GENERATION_SCRIPTS_ACTION, PersistenceUnitProperties.SCHEMA_GENERATION_CREATE_ACTION);
    cfg.put(PersistenceUnitProperties.SCHEMA_GENERATION_CREATE_SOURCE, PersistenceUnitProperties.SCHEMA_GENERATION_METADATA_SOURCE);
    cfg.put(PersistenceUnitProperties.SCHEMA_GENERATION_SCRIPTS_CREATE_TARGET, ddlTargetFile);
    cfg.put(PersistenceUnitProperties.SCHEMA_DATABASE_PRODUCT_NAME, databaseProductName);
    cfg.put(PersistenceUnitProperties.WEAVING, "false");
    
    if (databaseMajorVersion != null)
    {
        cfg.put(PersistenceUnitProperties.SCHEMA_DATABASE_MAJOR_VERSION, databaseMajorVersion);
    }
    
    if (databaseMinorVersion != null)
    {
        cfg.put(PersistenceUnitProperties.SCHEMA_DATABASE_MINOR_VERSION, databaseMinorVersion);
    }
    
    return cfg;
}
 
开发者ID:ethlo,项目名称:eclipselink-maven-plugin,代码行数:24,代码来源:EclipselinkDdlGenerationMojo.java

示例14: initEntityManagerFactory

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
private static void initEntityManagerFactory(DataSource dataSource) {
	logger.debug(DEBUG_INITIALIZING_ENTITY_MANAGER_FACTORY);

	Map<Object, Object> properties = new HashMap<>();
	properties.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, dataSource);

	EntityManagerFactoryProvider.entityManagerFactory = Persistence
			.createEntityManagerFactory(IndiaLocalizationPersistenceUnit.NAME, properties);

	logger.debug(DEBUG_ENTITY_MANAGER_FACTORY_INITIALIZED);
}
 
开发者ID:SAP,项目名称:cloud-ariba-partner-flow-extension-ext,代码行数:12,代码来源:EntityManagerFactoryProvider.java

示例15: getVendorProperties

import org.eclipse.persistence.config.PersistenceUnitProperties; //导入依赖的package包/类
@Override
protected Map<String, Object> getVendorProperties() {
    final Map<String, Object> baseProperties = new HashMap<>();
    baseProperties.put(PersistenceUnitProperties.TABLE_CREATION_SUFFIX, ";");
    baseProperties.put(PersistenceUnitProperties.SESSION_CUSTOMIZER, UUIDSequence.class.getName());
    baseProperties.put("eclipselink.weaving", "false");
    if (environment.acceptsProfiles("debug")) {
        baseProperties.put(PersistenceUnitProperties.LOGGING_LEVEL, "ALL");
    }
    return newHashMap(baseProperties);
}
 
开发者ID:pacphi,项目名称:track-shipments,代码行数:12,代码来源:EclipseLinkJpaConfiguration.java


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