• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HibernatePersistence类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: start

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
    this.bundleContext = bundleContext;
    debugPrintln("Activating ...");

    HibernatePersistence persistenceProvider = new HibernatePersistence();

    Dictionary<String, String> props = new Hashtable<String, String>();
    props.put(JAVAX_PERSISTENCE_PROVIDER_PROP, persistenceProvider
            .getClass().getName());

    serviceRegistration = context
            .registerService(PersistenceProvider.class.getName(),
                    persistenceProvider, props);

    debugPrintln("Service: ".concat(PersistenceProvider.class.getName())
            .concat(" registered. Bundle activated."));
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:19,代码来源:Activator.java


示例2: entityManagerFactory

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LOGGER.info("Configurando [entityManagerFactory]...");
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();

    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan("br.com.pandox.nursery");
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class);

    Properties hibernateProperties = new Properties();

    hibernateProperties.put("hibernate.hbm2ddl.auto", "create");

    hibernateProperties.put("hibernate.dialect", env.getProperty("hibernate.dialect"));
    hibernateProperties.put("hibernate.format_sql", "true");
    hibernateProperties.put("hibernate.show_sql", "false");

    entityManagerFactoryBean.setJpaProperties(hibernateProperties);

    LOGGER.info(entityManagerFactoryBean);
    return entityManagerFactoryBean;
}
 
开发者ID:matheusmessora,项目名称:nursery,代码行数:23,代码来源:ApplicationBoot.java


示例3: springfieldEntityManagerFactory

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
public LocalContainerEntityManagerFactoryBean springfieldEntityManagerFactory() throws Exception{
	logger.trace("create LocalContainerEntityManagerFactoryBean "+basePackage);
	String dialect = HibernateDialectType.fromMetaData(dataSource).getDialect(); 
	
	Properties p = new Properties();
	p.put("hibernate.cache.provider_class",  "org.hibernate.cache.HashtableCacheProvider");
	p.put("hibernate.dialect" , dialect);
	p.put("hibernate.show_sql", "true");
	p.put("hibernate.format_sql", "true");
	p.put("hibernate.hbm2ddl.auto", "update");
	
	LocalContainerEntityManagerFactoryBean b = new LocalContainerEntityManagerFactoryBean();
	b.setPersistenceUnitName("springfield");
	b.setPersistenceProviderClass(HibernatePersistence.class);
	b.setJpaProperties(p);

	b.setDataSource(dataSource);
	b.setPackagesToScan(basePackage);
	//b.afterPropertiesSet();
	
	return b;
}
 
开发者ID:u2ware,项目名称:springfield,代码行数:23,代码来源:ContextRepositoryJpa.java


示例4: createEntityManagerFactory

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) {
    
	EntityManagerFactory emf = null;
    List<PersistenceProvider> providers = getProviders();
    PersistenceProvider defaultProvider = null;
    for (PersistenceProvider provider : providers) {
        if (provider instanceof HibernatePersistence) {
            defaultProvider = provider;
            continue;
        }
        emf = provider.createEntityManagerFactory(persistenceUnitName, properties);
        if (emf != null) {
            break;
        }
    }
    if (emf == null && defaultProvider != null)
        emf = defaultProvider.createEntityManagerFactory( persistenceUnitName, properties );
    if ( emf == null ) {
        throw new PersistenceException( "No Persistence provider for EntityManager named " + persistenceUnitName );
    }
    return emf;
}
 
开发者ID:intercommit,项目名称:hibhik,代码行数:23,代码来源:CustomPersistence.java


示例5: entityManagerFactoryBean

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
/**
 * Entity manager factory bean.
 * 
 * @return the local container entity manager factory bean
 */
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
        LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
        factoryBean.setDataSource(this.dataSource());
        factoryBean
                        .setPackagesToScan(environment.getRequiredProperty(PACKAGES_TO_SCAN));
        factoryBean.setPersistenceProviderClass(HibernatePersistence.class);

        Properties jpaProperties = new Properties();
        jpaProperties.put(HIBERNATE_DIALECT,
                        environment.getRequiredProperty(HIBERNATE_DIALECT));
        jpaProperties.put(HIBERNATE_FORMAT_SQL, environment.getRequiredProperty(HIBERNATE_FORMAT_SQL));
        jpaProperties.put(HIBERNATE_SHOW_SQL, environment.getRequiredProperty(HIBERNATE_SHOW_SQL));
        
        factoryBean.setJpaProperties(jpaProperties);
        return factoryBean;
}
 
开发者ID:npaulus,项目名称:Daily-Email-WebApp,代码行数:23,代码来源:PersistenceJpaConfig.java


示例6: entityManagerFactory

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
	entityManagerFactoryBean.setDataSource(dataSource());
	entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class);
	entityManagerFactoryBean.setPackagesToScan(env.getRequiredProperty(PROP_ENTITYMANAGER_PACKAGES_TO_SCAN));

	entityManagerFactoryBean.setJpaProperties(getHibernateProperties());

	return entityManagerFactoryBean;
}
 
开发者ID:noveogroup-amorgunov,项目名称:spring-mvc-react,代码行数:12,代码来源:SpringWebConfig.java


示例7: newEntityManagerFactory

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
protected EntityManagerFactory newEntityManagerFactory() {
    PersistenceUnitInfo persistenceUnitInfo = persistenceUnitInfo(getClass().getSimpleName());
    Map<String, Object> configuration = new HashMap<String, Object>();

    HibernatePersistence hibernatePersistence = new HibernatePersistence();
    return hibernatePersistence.createContainerEntityManagerFactory(persistenceUnitInfo, configuration);
}
 
开发者ID:vladmihalcea,项目名称:hibernate-types,代码行数:8,代码来源:AbstractTest.java


示例8: createParser

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Before
public void createParser() throws IOException {
    entityManagerFactory = new HibernatePersistence().createEntityManagerFactory("metamodel", null);
    Set<String> ormXmlLocations = new HashSet<String>();
    ormXmlLocations.add("META-INF/all.orm.xml");
    ormXmlLocations.add("META-INF/empty.orm.xml");
    ormXmlLocations.add("META-INF/parent.orm.xml");
    parser = new NamedQueryParser(entityManagerFactory.getMetamodel(), ormXmlLocations);
}
 
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:10,代码来源:NamedQueryParserTest.java


示例9: createEntityManagerFactoryBean

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
protected LocalContainerEntityManagerFactoryBean createEntityManagerFactoryBean(DataSource dataSource, String dialectClassName) {
    Map<String, String> properties = new HashMap<String, String>();
    properties.put(org.hibernate.cfg.Environment.HBM2DDL_AUTO, "update");
    properties.put(org.hibernate.cfg.Environment.DIALECT, dialectClassName);
    properties.put(org.hibernate.cfg.Environment.SHOW_SQL, "true");

    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource);
    em.setPackagesToScan(Album.class.getPackage().getName());
    em.setPersistenceProvider(new HibernatePersistence());
    em.setJpaPropertyMap(properties);
    return em;
}
 
开发者ID:pivotalservices,项目名称:concourse-spring-music,代码行数:14,代码来源:AbstractJpaRepositoryConfig.java


示例10: entityManagerFactory

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws ClassNotFoundException {
    LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();

    System.out.println("url: " + environment.getProperty(PROPERTY_NAME_DATABASE_URL));

    bean.setDataSource(dataSource());
    bean.setPackagesToScan(environment.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));
    bean.setPersistenceProviderClass(HibernatePersistence.class);
    // bean.setPersistenceUnitName(environment
    // .getRequiredProperty(PROPERTY_NAME_PERSISTENCE_UNIT_NAME));

    HibernateJpaVendorAdapter va = new HibernateJpaVendorAdapter();
    bean.setJpaVendorAdapter(va);

    Properties jpaProperties = new Properties();
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_DIALECT,
            environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_DIALECT));
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_FORMAT_SQL,
            environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_FORMAT_SQL));
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY,
            environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY));
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL,
            environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_SHOW_SQL));
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO,
            environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO));

    bean.setJpaProperties(jpaProperties);

    return bean;
}
 
开发者ID:beargiles,项目名称:spring-entity-listener,代码行数:32,代码来源:ApplicationContext.java


示例11: entityManagerFactory

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws ClassNotFoundException {
    LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();

    bean.setDataSource(dataSource());
    bean.setPackagesToScan(environment.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));
    bean.setPersistenceProviderClass(HibernatePersistence.class);
    // bean.setPersistenceUnitName(environment
    // .getRequiredProperty(PROPERTY_NAME_PERSISTENCE_UNIT_NAME));

    HibernateJpaVendorAdapter va = new HibernateJpaVendorAdapter();
    bean.setJpaVendorAdapter(va);

    Properties jpaProperties = new Properties();
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_DIALECT, "org.hibernate.dialect.H2Dialect");
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_FORMAT_SQL,
            environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_FORMAT_SQL));
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY,
            environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY));
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL,
            environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_SHOW_SQL));
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO,
            environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO));

    bean.setJpaProperties(jpaProperties);

    return bean;
}
 
开发者ID:beargiles,项目名称:project-student,代码行数:29,代码来源:TestPersistenceJpaConfig.java


示例12: emf

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean(name="entityManagerFactory")
@DependsOn({"liquibase", "dataSource"})
FactoryBean<EntityManagerFactory> emf(JpaVendorAdapter jpaVendorAdapter) {
    SimpleHiloIdentifierGenerator.setDataSource(dataSource());
    LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean();
    fb.setJpaProperties(hibernateProperties());
    fb.setDataSource(dataSource());
    fb.setPersistenceProviderClass(HibernatePersistence.class);
    fb.setPackagesToScan("io.cloudslang");
    fb.setJpaVendorAdapter(jpaVendorAdapter);
    return fb;
}
 
开发者ID:CloudSlang,项目名称:score,代码行数:13,代码来源:ExecutionStateRepositoryTest.java


示例13: entityManagerFactory

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean
@DependsOn("liquibase")
FactoryBean<EntityManagerFactory> entityManagerFactory(JpaVendorAdapter jpaVendorAdapter) {
	LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean();
	fb.setDataSource(dataSource());
	fb.setPersistenceProviderClass(HibernatePersistence.class);
	fb.setPackagesToScan("io.cloudslang.engine.partitions");
	fb.setJpaVendorAdapter(jpaVendorAdapter);
	return fb;
}
 
开发者ID:CloudSlang,项目名称:score,代码行数:11,代码来源:PartitionTemplateWithEmfTest.java


示例14: emf

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean(name="entityManagerFactory")
@DependsOn("liquibase")
FactoryBean<EntityManagerFactory> emf(JpaVendorAdapter jpaVendorAdapter) {
	LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean();
	fb.setJpaProperties(hibernateProperties());
	fb.setDataSource(dataSource());
	fb.setPersistenceProviderClass(HibernatePersistence.class);
	fb.setPackagesToScan("io.cloudslang.engine.versioning");
	fb.setJpaVendorAdapter(jpaVendorAdapter);
	return fb;
}
 
开发者ID:CloudSlang,项目名称:score,代码行数:12,代码来源:VersionRepositoryTest.java


示例15: emf

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean(name="entityManagerFactory")
@DependsOn("liquibase")
FactoryBean<EntityManagerFactory> emf(JpaVendorAdapter jpaVendorAdapter) {
	LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean();
	fb.setJpaProperties(hibernateProperties());
	fb.setDataSource(dataSource());
	fb.setPersistenceProviderClass(HibernatePersistence.class);
	fb.setPackagesToScan("io.cloudslang.engine.node");
	fb.setJpaVendorAdapter(jpaVendorAdapter);
	return fb;
}
 
开发者ID:CloudSlang,项目名称:score,代码行数:12,代码来源:WorkerNodeServiceTest.java


示例16: emf

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean(name = "entityManagerFactory")
@DependsOn("liquibase")
FactoryBean<EntityManagerFactory> emf(JpaVendorAdapter jpaVendorAdapter, Properties jpaProperties) {
    LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean();
    fb.setDataSource(dataSource());
    fb.setJpaProperties(jpaProperties);
    fb.setPersistenceProviderClass(HibernatePersistence.class);
    fb.setPackagesToScan("io.cloudslang");
    fb.setJpaVendorAdapter(jpaVendorAdapter);
    return fb;
}
 
开发者ID:CloudSlang,项目名称:score,代码行数:12,代码来源:EngineTest.java


示例17: entityManagerFactory

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean
   @DependsOn("liquibase")
LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
	//Init the IdentityManager
	SimpleHiloIdentifierGenerator.setDataSource(dataSource);

       //Now create the bean
       LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource);
	emf.setJpaProperties(jpaProperties());
       emf.setJpaVendorAdapter(jpaVendorAdapter());
       emf.setPersistenceProviderClass(HibernatePersistence.class);
       emf.setPackagesToScan("io.cloudslang");
       return emf;
   }
 
开发者ID:CloudSlang,项目名称:score,代码行数:16,代码来源:ScoreDatabaseContext.java


示例18: entityManagerFactory

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
	entityManagerFactoryBean.setDataSource(dataSource());
	entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class);
	entityManagerFactoryBean.setPackagesToScan(env.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));
	
	entityManagerFactoryBean.setJpaProperties(hibProperties());
	
	return entityManagerFactoryBean;
}
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:12,代码来源:WebConfig.java


示例19: start

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
    HibernatePersistence persistence = new HibernatePersistence();
    Dictionary<String, String> props = new Hashtable<String, String>();
    props.put(JAVAX_PERSISTENCE_PROVIDER_PROP, persistence.getClass().getName());
    serviceRegistration = context.registerService(PersistenceProvider.class.getName(), persistence, props);
}
 
开发者ID:vandewilly,项目名称:osgi-jpa,代码行数:8,代码来源:Activator.java


示例20: HibernatePersistenceProvider

import org.hibernate.ejb.HibernatePersistence; //导入依赖的package包/类
public HibernatePersistenceProvider(final HibernatePersistence delegate,
        final ServiceTracker transactionManagerTracker,
        final ServiceTracker userTransactionTracker) {
    super();
    this.delegate = delegate;
    this.transactionManagerTracker = transactionManagerTracker;
    this.userTransactionTracker = userTransactionTracker;
}
 
开发者ID:everit-org-archive,项目名称:osgi-hibernate,代码行数:9,代码来源:HibernatePersistenceProvider.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XMLX509IssuerSerial类代码示例发布时间:2022-05-21
下一篇:
Java Date类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap