本文整理汇总了Java中org.eclipse.persistence.config.TargetServer类的典型用法代码示例。如果您正苦于以下问题:Java TargetServer类的具体用法?Java TargetServer怎么用?Java TargetServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TargetServer类属于org.eclipse.persistence.config包,在下文中一共展示了TargetServer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDbProperties
import org.eclipse.persistence.config.TargetServer; //导入依赖的package包/类
private static Map<String, String> getDbProperties() {
Map<String, String> properties = new HashMap<String, String>();
// Ensure RESOURCE_LOCAL transactions is used.
properties.put(TRANSACTION_TYPE, PersistenceUnitTransactionType.RESOURCE_LOCAL.name());
// Ensure that no server-platform is configured
properties.put(TARGET_SERVER, TargetServer.None);
// give the package name of metaentities
properties.put("eclipselink.canonicalmodel.subpackage", "metaentity");
return properties;
}
示例2: getDbProperties
import org.eclipse.persistence.config.TargetServer; //导入依赖的package包/类
private static Map<String, String> getDbProperties() {
Map<String, String> properties = new HashMap<String, String>();
// Ensure RESOURCE_LOCAL transactions is used.
properties.put(TRANSACTION_TYPE,
PersistenceUnitTransactionType.RESOURCE_LOCAL.name());
// Configure the internal EclipseLink connection pool
properties.put(JDBC_DRIVER, "org.postgresql.Driver");
// properties.put(JDBC_URL, "jdbc:postgresql://localhost/IneFormTest");
// properties.put(JDBC_USER, "postgres");
// properties.put(JDBC_PASSWORD, "ine123pex");
properties.put(JDBC_URL, "jdbc:postgresql://localhost/IneFormTest");
properties.put(JDBC_USER, "IneFormTest");
properties.put(JDBC_PASSWORD, "IneFormTest");
// Configure logging. FINE ensures all SQL is shown
properties.put(LOGGING_LEVEL, "FINE");
properties.put(LOGGING_TIMESTAMP, "false");
properties.put(LOGGING_THREAD, "false");
properties.put(LOGGING_SESSION, "false");
// Ensure that no server-platform is configured
properties.put(TARGET_SERVER, TargetServer.None);
//give the package name of metaentities
properties.put("eclipselink.canonicalmodel.subpackage", "metaentity");
return properties;
}
示例3: assignPropertiesTM
import org.eclipse.persistence.config.TargetServer; //导入依赖的package包/类
/**
* @return {@link Properties}
*/
private static Properties assignPropertiesTM() {
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.TARGET_DATABASE,
"org.eclipse.persistence.platform.database.H2Platform");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, "org.h2.Driver");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.JDBC_URL, "jdbc:h2:mem:jped-persist");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.JDBC_USER, "persist");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, "persist");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.LOGGING_LOGGER, "DefaultLogger");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.LOGGING_LEVEL, "FINE");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.LOGGING_TIMESTAMP, "false");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.LOGGING_THREAD, "false");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.LOGGING_SESSION, "false");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.LOGGING_EXCEPTIONS, "false");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.CONNECTION_POOL_READ, "1");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.CONNECTION_POOL_INITIAL, "1");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.CONNECTION_POOL_MIN, "1");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.CONNECTION_POOL_MAX, "10");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.TARGET_SERVER, TargetServer.None);
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.DDL_GENERATION, "create-tables");
JpaEmbeddedH2Properties.properties.setProperty(PersistenceUnitProperties.DDL_GENERATION_MODE, "both");
return JpaEmbeddedH2Properties.properties;
}
示例4: init
import org.eclipse.persistence.config.TargetServer; //导入依赖的package包/类
public void init(String unitName) {
Map<String, String> properties = Maps.newHashMap();
// Ensure RESOURCE_LOCAL transactions is used.
properties.put(TRANSACTION_TYPE, PersistenceUnitTransactionType.RESOURCE_LOCAL.name());
// Configure the internal EclipseLink connection pool
properties.put(JDBC_DRIVER, dbDriver);
properties.put(JDBC_URL, dbUrl);
properties.put(JDBC_USER, dbUser);
properties.put(JDBC_PASSWORD, dbPassword);
properties.put(JDBC_READ_CONNECTIONS_MIN, minRead);
properties.put(JDBC_WRITE_CONNECTIONS_MIN, minWrite);
// Configure logging. FINE ensures all SQL is shown
properties.put(LOGGING_LEVEL, "FINE");
properties.put(LOGGING_TIMESTAMP, "true");
properties.put(LOGGING_THREAD, "false");
properties.put(LOGGING_SESSION, "false");
// Ensure that no server-platform is configured
properties.put(TARGET_SERVER, TargetServer.None);
properties.put(PersistenceUnitProperties.DDL_GENERATION, PersistenceUnitProperties.CREATE_ONLY);
properties.put(PersistenceUnitProperties.DROP_JDBC_DDL_FILE, "drop.sql");
properties.put(PersistenceUnitProperties.CREATE_JDBC_DDL_FILE, "create.sql");
properties.put(PersistenceUnitProperties.DDL_GENERATION_MODE,
PersistenceUnitProperties.DDL_BOTH_GENERATION);
// properties.put(PersistenceUnitProperties.SESSION_CUSTOMIZER,
// EnableIntegrityChecker.class.getName());
LOG.info("Starting connection manager with properties " + properties);
EntityManagerFactory emFactory = Persistence.createEntityManagerFactory(unitName, properties);
entityManager = emFactory.createEntityManager();
}