本文整理汇总了Java中javax.persistence.EntityManager.getEntityManagerFactory方法的典型用法代码示例。如果您正苦于以下问题:Java EntityManager.getEntityManagerFactory方法的具体用法?Java EntityManager.getEntityManagerFactory怎么用?Java EntityManager.getEntityManagerFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.EntityManager
的用法示例。
在下文中一共展示了EntityManager.getEntityManagerFactory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRepositoryFactory
import javax.persistence.EntityManager; //导入方法依赖的package包/类
@Override
protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityManager) {
DatasourceMapper datasourceMapper = new JpaDatasourceMapper(entityManager.getEntityManagerFactory());
SnowdropOperations operations = new SnowdropTemplate(datasourceMapper);
SnowdropRepositoryFactory snowdropRepositoryFactory = new SnowdropRepositoryFactory(operations);
postProcessors.forEach(p -> p.postProcess(snowdropRepositoryFactory));
return new JpaWithSnowdropRepositoryFactory(entityManager, snowdropRepositoryFactory);
}
示例2: BeanNotificacion
import javax.persistence.EntityManager; //导入方法依赖的package包/类
public BeanNotificacion() {
try {
ctx = new InitialContext();
utx = (UserTransaction) ctx.lookup("java:comp/env/UserTransaction");
em = (EntityManager) ctx.lookup("java:comp/env/persistence/LogicalName");
jpa = new NotificacionesJpaController(utx, em.getEntityManagerFactory());
} catch (NamingException ex) {
}
}
示例3: BeanUsuarios
import javax.persistence.EntityManager; //导入方法依赖的package包/类
public BeanUsuarios() {
try {
ctx = new InitialContext();
utx = (UserTransaction) ctx.lookup("java:comp/env/UserTransaction");
em = (EntityManager) ctx.lookup("java:comp/env/persistence/LogicalName");
jpa = new UsuarioJpaController(utx, em.getEntityManagerFactory());
} catch (NamingException ex) {
}
}