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


Java JpaRepositoryFactory类代码示例

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


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

示例1: setUp

import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; //导入依赖的package包/类
/**
    * Creates a {@link SimpleUserRepository} instance.
    * 
    * @throws Exception
    */
   @Before
public void setUp() {

	em = factory.createEntityManager();

	projectRepository = new JpaRepositoryFactory(em).getRepository(TMProjectRepository.class);
	userRepository = new JpaRepositoryFactory(em).getRepository(TMUserRepository.class);

	em.getTransaction().begin();
	user = new TMUser("jchaganti", "jch");
	user = userRepository.save(user);
	project = TMProject.getBuilder(user,  "description", "title").build();
	project = projectRepository.save(project);
	em.getTransaction().commit();

}
 
开发者ID:jchaganti,项目名称:tasquemann,代码行数:22,代码来源:BasicFactorySetup.java

示例2: invoke

import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; //导入依赖的package包/类
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    if (repository.get() == null) {
        synchronized (this) {
            if (repository.get() == null) {
                repository.set(new JpaRepositoryFactory(em).getRepository(implementingInterfaceClass));
            }
        }
    }
    return method.invoke(repository.get(), args);
}
 
开发者ID:apache,项目名称:tomee,代码行数:12,代码来源:SpringDataProxy.java

示例3: afterPropertiesSet

import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; //导入依赖的package包/类
@Override
public void afterPropertiesSet() {
    applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
    this.jpaRepositoryFactory = new JpaRepositoryFactory(entityManager);
    try {
        // Make sure calls to the repository instance are intercepted for annotated transactions
        Class transactionalRepositoryProxyPostProcessor = Class.forName("org.springframework.data.repository.core.support.TransactionalRepositoryProxyPostProcessor");
        final Constructor constructor = transactionalRepositoryProxyPostProcessor.getConstructor(ListableBeanFactory.class, String.class);
        final RepositoryProxyPostProcessor repositoryProxyPostProcessor = (RepositoryProxyPostProcessor)
                constructor.newInstance(applicationContext.getBeanFactory(), TxUtils.DEFAULT_TRANSACTION_MANAGER);
        jpaRepositoryFactory.addRepositoryProxyPostProcessor(repositoryProxyPostProcessor);
    } catch (Exception e) {
        log.error("Failed to initialize the TransactionalRepositoryProxyPostProcessor class", e);
    }
}
 
开发者ID:exteso,项目名称:parkingfriends,代码行数:16,代码来源:SpringReloader.java

示例4: setUp

import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; //导入依赖的package包/类
/**
 * Creates a {@link SimpleUserRepository} instance.
 * 
 * @throws Exception
 */
@Before
public void setUp() {

	em = factory.createEntityManager();

	userRepository = new JpaRepositoryFactory(em).getRepository(SimpleUserRepository.class);

	em.getTransaction().begin();

	user = new User();
	user.setUsername("username");
	user.setFirstname("firstname");
	user.setLastname("lastname");

	user = userRepository.save(user);

}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:23,代码来源:BasicFactorySetup.java

示例5: repositoryFactorySupport

import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; //导入依赖的package包/类
@Bean
public RepositoryFactorySupport repositoryFactorySupport(){
    LOGGER.info("In bean repositoryFactorySupport() entity manager is : {}", em.toString());
    return new JpaRepositoryFactory(em);
}
 
开发者ID:StnetixDevTeam,项目名称:ariADDna,代码行数:6,代码来源:AppConfiguration.java

示例6: repositoryFactory

import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; //导入依赖的package包/类
@Bean
public JpaRepositoryFactory repositoryFactory(EntityManagerFactory emf) {
    return new JpaRepositoryFactory(emf.createEntityManager());
}
 
开发者ID:nikboyd,项目名称:axiom-lib-java,代码行数:5,代码来源:PersistenceContext.java

示例7: addressStorage

import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; //导入依赖的package包/类
@Bean
public AddressStorage addressStorage(JpaRepositoryFactory rf) {
    return rf.getRepository(AddressStorage.class);
}
 
开发者ID:nikboyd,项目名称:axiom-lib-java,代码行数:5,代码来源:PersistenceContext.java

示例8: emailStorage

import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; //导入依赖的package包/类
@Bean
public EmailStorage emailStorage(JpaRepositoryFactory rf) {
    return rf.getRepository(EmailStorage.class);
}
 
开发者ID:nikboyd,项目名称:axiom-lib-java,代码行数:5,代码来源:PersistenceContext.java

示例9: phoneStorage

import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; //导入依赖的package包/类
@Bean
public PhoneStorage phoneStorage(JpaRepositoryFactory rf) {
    return rf.getRepository(PhoneStorage.class);
}
 
开发者ID:nikboyd,项目名称:axiom-lib-java,代码行数:5,代码来源:PersistenceContext.java


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