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


Java JDOHelper.getPersistenceManagerFactory方法代码示例

本文整理汇总了Java中javax.jdo.JDOHelper.getPersistenceManagerFactory方法的典型用法代码示例。如果您正苦于以下问题:Java JDOHelper.getPersistenceManagerFactory方法的具体用法?Java JDOHelper.getPersistenceManagerFactory怎么用?Java JDOHelper.getPersistenceManagerFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.jdo.JDOHelper的用法示例。


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

示例1: init

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
public void init(int doublesPerRow) {
	System.out.println("Storing to database");
	ZooHelper.getDataStoreManager().createDb(dbName);
	
	ZooJdoProperties prop = new ZooJdoProperties(dbName);
	PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(prop);
	pmf.setRetainValues(false);
	pm = pmf.getPersistenceManager();
	pm.currentTransaction().begin();
	
	list = new PersistentArrayDoubleParent(doublesPerRow);
	pm.makePersistent(list);
	
	pad = list.getNextForWrite2();
	data = pad.getData();
}
 
开发者ID:tzaeschke,项目名称:TinSpin,代码行数:17,代码来源:DbWriter.java

示例2: start

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
@Override
public void start(Properties conf, UpdateLoggerFactory updateLoggerFactory)
        throws MetaException {
    Properties props = new Properties();
    props.setProperty("javax.jdo.PersistenceManagerFactoryClass", "org.datanucleus.api.jdo.JDOPersistenceManagerFactory");
    props.setProperty("datanucleus.ConnectionDriverName", conf.getProperty("metastore.jdo.connection.drivername"));
    props.setProperty("datanucleus.ConnectionURL", conf.getProperty("metastore.jdo.connection.URL"));
    props.setProperty("datanucleus.ConnectionUserName", conf.getProperty("metastore.jdo.connection.username"));
    props.setProperty("datanucleus.ConnectionPassword", conf.getProperty("metastore.jdo.connection.password"));
    props.setProperty("datanucleus.connectionPoolingType", "DBCP");
    props.setProperty("datanucleus.schema.autoCreateAll", "true");

    if (conf.getProperty("metastore.jdo.connection.drivername").equals("org.sqlite.JDBC")) {
        // for sequences
        props.setProperty("datanucleus.valuegeneration.transactionAttribute", "UsePM");
        // connection pooling occurs NullPointerException
        props.setProperty("datanucleus.connectionPoolingType", "None");
        props.setProperty("datanucleus.connectionPoolingType.nontx", "None");
    }

    pmf = JDOHelper.getPersistenceManagerFactory(props);
    JDOMetaStore.ulf = updateLoggerFactory;
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:24,代码来源:JDOMetaStore.java

示例3: getPersistManager

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
private PersistenceManager getPersistManager(MetadbConf metadbConf) {
  //TODO: get params from dbConf
  String driver = metadbConf.getJdbcDriverName();

  LOG.info("Connecting to Metastore with driver: " + driver);

  Properties properties = new Properties();
  properties.setProperty("javax.jdo.option.ConnectionURL",
          "jdbc:derby:metastore_db;create=true");

  properties.setProperty("javax.jdo.option.ConnectionDriverName",
          driver);

  properties.setProperty("javax.jdo.option.ConnectionUserName", "");
  properties.setProperty("javax.jdo.option.ConnectionPassword", "");
  properties.setProperty("datanucleus.schema.autoCreateSchema", "true");
  properties.setProperty("datanucleus.schema.autoCreateTables", "true");
  properties.setProperty("datanucleus.schema.validateTables", "false");
  properties.setProperty("datanucleus.schema.validateConstraints", "false");

  PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(properties);
  PersistenceManager pm = pmf.getPersistenceManager();

  return  pm;
}
 
开发者ID:andyhehk,项目名称:SecureDB,代码行数:26,代码来源:ConnectionPool.java

示例4: prepareTestDB

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
public MetaStore prepareTestDB() {
  MetaStore metadb;
  try {
    Class.forName(driver).newInstance();
  } catch (InstantiationException | IllegalAccessException
          | ClassNotFoundException e) {
    e.printStackTrace();
  }

  Properties properties = TestUtility.createProperty();

  pmf = JDOHelper.getPersistenceManagerFactory(properties);
  pm = pmf.getPersistenceManager();

  DBMeta dbMeta = TestQuery.createDBMeta();
  metadb = new MetaStore(dbMeta.getName(), pm);
  metadb.addDB(dbMeta);

  return metadb;
}
 
开发者ID:andyhehk,项目名称:SecureDB,代码行数:21,代码来源:SdbSchemeRewriterTest.java

示例5: prepareTestDB

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
/**
 * Prepare a in-memory database for testing
 */
@Before
public void prepareTestDB() {
  try {
    Class.forName(driver).newInstance();
  } catch (InstantiationException | IllegalAccessException
          | ClassNotFoundException e) {
    e.printStackTrace();
  }

  Properties properties = new Properties();
  properties.setProperty("javax.jdo.option.ConnectionURL",
          "jdbc:derby:memory:test_db;create=true");
  properties.setProperty("javax.jdo.option.ConnectionDriverName",
          "org.apache.derby.jdbc.EmbeddedDriver");
  properties.setProperty("javax.jdo.option.ConnectionUserName", "");
  properties.setProperty("javax.jdo.option.ConnectionPassword", "");
  properties.setProperty("datanucleus.schema.autoCreateSchema", "true");
  properties.setProperty("datanucleus.schema.autoCreateTables", "true");
  properties.setProperty("datanucleus.schema.validateTables", "false");
  properties.setProperty("datanucleus.schema.validateConstraints", "false");

  pmf = JDOHelper.getPersistenceManagerFactory(properties);
  pm = pmf.getPersistenceManager();
}
 
开发者ID:andyhehk,项目名称:SecureDB,代码行数:28,代码来源:MetaStoreTest.java

示例6: prepareTestDB

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
public MetaStore prepareTestDB() {
  MetaStore metadb;
  try {
    Class.forName(driver).newInstance();
  } catch (InstantiationException | IllegalAccessException
          | ClassNotFoundException e) {
    e.printStackTrace();
  }

  Properties properties = TestUtility.createProperty();

  pmf = JDOHelper.getPersistenceManagerFactory(properties);
  pm = pmf.getPersistenceManager();

  DBMeta dbMeta = TestQuery.createDBMetaSimple();
  metadb = new MetaStore(dbMeta.getName(), pm);
  metadb.addDB(dbMeta);

  return metadb;
}
 
开发者ID:andyhehk,项目名称:SecureDB,代码行数:21,代码来源:SemanticAnalyzerTest.java

示例7: createDatastore

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
@BeforeClass
public static void createDatastore() {
  Map<String, String> props = new HashMap<>();
  props.put("javax.jdo.option.ConnectionURL", "jdbc:hsqldb:mem:test");
  props.put("javax.jdo.option.ConnectionDriverName", "org.hsqldb.jdbcDriver");
  props.put("javax.jdo.option.ConnectionUserName", "sa");
  props.put("javax.jdo.option.ConnectionPassword", "");
  props.put("datanucleus.schema.autoCreateAll", "true");
  /*
   * The RetainValues option is important if we verify interaction involving objects which outlive
   * their persistence manager. While this should not happen during normal interaction, it does
   * happen when verifying interactions with mockito.
   */
  props.put("javax.jdo.option.RetainValues", "true");
  pmf = JDOHelper.getPersistenceManagerFactory(props, "core");
}
 
开发者ID:OsuCelebrity,项目名称:OsuCelebrity,代码行数:17,代码来源:AbstractJDOTest.java

示例8: initPersistenceManagerFactoryAndPersistenceCapableClasses

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
private void initPersistenceManagerFactoryAndPersistenceCapableClasses(final boolean createRepository) {
	final Map<String, String> persistenceProperties = getPersistenceProperties(createRepository);
	persistenceManagerFactory = JDOHelper.getPersistenceManagerFactory(persistenceProperties);
	final PersistenceManager pm = persistenceManagerFactory.getPersistenceManager();
	try {
		try {
			initPersistenceCapableClasses(pm);
		} catch (final Exception x) {
			if (x instanceof RuntimeException)
				throw (RuntimeException)x;
			else
				throw new RuntimeException(x);
		}
	} finally {
		if (pm != null)
			pm.close();
	}
}
 
开发者ID:cloudstore,项目名称:cloudstore,代码行数:19,代码来源:LocalRepoManagerImpl.java

示例9: createPersistenceManager

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
/**
 * Creates a new JDO PersistenceManager.
 * @return a PersistenceManager
 */
public static PersistenceManager createPersistenceManager() {
    if (Config.isUnitTestsEnabled()) {
        pmf = JDOHelper.getPersistenceManagerFactory(JDO_OVERRIDES, "Alpine");
    }
    if (pmf == null) {
        throw new IllegalStateException("Context is not initialized yet.");
    }
    return pmf.getPersistenceManager();
}
 
开发者ID:stevespringett,项目名称:Alpine,代码行数:14,代码来源:PersistenceManagerFactory.java

示例10: main

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
public static void main(String[] args) {
	PersistenceManagerFactory persistenceManagerFactory = JDOHelper.getPersistenceManagerFactory("Tutorial");
	PersistenceManager persistenceManager = persistenceManagerFactory.getPersistenceManager();
	
	List<Item> executeList = persistenceManager.newQuery(Item.class).filter("").executeList();
	System.out.println(executeList);
	Item pc = persistenceManager.newInstance(Item.class);
	//pc.related.add(executeList.get(0));
	//pc.id=1;
	Product ps=new Product();
	pc.product=ps;
	pc.url="DD";
	persistenceManager.makePersistent(pc);
	//persistenceManager.currentTransaction().commit();		
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:16,代码来源:T.java

示例11: getPMF

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
public static PersistenceManagerFactory getPMF() {
	final Properties properties = commonProperties(false);
	properties.setProperty("javax.jdo.option.ConnectionURL", "jdbc:postgresql://localhost/mutinack_test_db");
	properties.setProperty("javax.jdo.option.ConnectionDriverName", "org.postgresql.Driver");
	properties.setProperty("javax.jdo.option.ConnectionUserName", "testuser3");
	properties.setProperty("javax.jdo.option.ConnectionPassword", "testpassword34");
	PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(properties);
	return pmf;
}
 
开发者ID:cinquin,项目名称:mutinack,代码行数:10,代码来源:PMF.java

示例12: registerFactory

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
private void registerFactory(String clientName, String databaseName, DataSource ds) {
  	Properties connectionProperties = (Properties) dataNucleusProperties.clone();
  	connectionProperties.put("javax.jdo.option.ConnectionFactory", ds);
if (databaseName != null)
  		connectionProperties.setProperty("datanucleus.mapping.Catalog", databaseName);
  	logger.info("Adding PMF factory for client "+clientName+" with database "+databaseName);
      PersistenceManagerFactory factory = JDOHelper.getPersistenceManagerFactory(connectionProperties);
      factories.put(clientName, factory);
  }
 
开发者ID:SeldonIO,项目名称:seldon-server,代码行数:10,代码来源:JDOFactory.java

示例13: SingletonConexion

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
/**
 * Constructor de la clase que nos garantiza que sea una unica instancia a
 * traves del singleton.
 */
public SingletonConexion() {
	singleton = Singleton.getInstance();
	String db=new IniFile("conf.ini").getParameters("db");
	Properties p = new Properties();
	try{
		if (db.equals("MYSQL"))	p.load(new FileInputStream("MYSQL.properties"));
		else p.load(new FileInputStream("POSTGRES.properties"));
		pmf = JDOHelper.getPersistenceManagerFactory(p);
	}catch (Exception e){
		pmf = JDOHelper.getPersistenceManagerFactory(db);
	}
}
 
开发者ID:lucianoit10,项目名称:itRegistro,代码行数:17,代码来源:SingletonConexion.java

示例14: setup

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
  dataDir = new File(Files.createTempDir(), "sentry_policy_db");
  Properties prop = new Properties();
  prop.setProperty(ServerConfig.JAVAX_JDO_URL, "jdbc:derby:;databaseName=" + dataDir.getPath() + ";create=true");
  prop.setProperty(ServerConfig.JAVAX_JDO_USER, "Sentry");
  prop.setProperty(ServerConfig.JAVAX_JDO_PASS, "Sentry");
  prop.setProperty(ServerConfig.JAVAX_JDO_DRIVER_NAME, "org.apache.derby.jdbc.EmbeddedDriver");
  prop.setProperty("datanucleus.autoCreateSchema", "true");
  prop.setProperty("datanucleus.fixedDatastore", "false");
  prop.setProperty("datanucleus.NontransactionalRead", "false");
  prop.setProperty("datanucleus.NontransactionalWrite", "false");
  pmf = JDOHelper.getPersistenceManagerFactory(prop);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:15,代码来源:TestSentryRole.java

示例15: contextInitialized

import javax.jdo.JDOHelper; //导入方法依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
    LOGGER.info("Initializing persistence framework");
    pmf = JDOHelper.getPersistenceManagerFactory("Alpine");
}
 
开发者ID:stevespringett,项目名称:Alpine,代码行数:6,代码来源:PersistenceManagerFactory.java


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