Exemplo n.º 1
0
  @Bean(name = "transactionManager")
  public JpaTransactionManager transactionManager() throws IOException {
    JpaTransactionManager txManager = new JpaTransactionManager();
    txManager.setEntityManagerFactory(emf().getObject());

    return txManager;
  }
Exemplo n.º 2
0
  @Bean
  public PlatformTransactionManager transactionManager() {

    JpaTransactionManager txManager = new JpaTransactionManager();
    txManager.setEntityManagerFactory(entityManagerFactory());
    return txManager;
  }
Exemplo n.º 3
0
 @Bean
 public JpaTransactionManager transactionManager() {
   JpaTransactionManager jpaTransactionManager = new JpaTransactionManager();
   jpaTransactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
   jpaTransactionManager.setJpaDialect(jpaDialect());
   return jpaTransactionManager;
 }
 @Bean
 public PlatformTransactionManager transactionManager() {
   JpaTransactionManager tm = new JpaTransactionManager();
   tm.setEntityManagerFactory(emf);
   tm.setDataSource(dataSource);
   return tm;
 }
  @Bean
  public JpaTransactionManager transactionManager(EntityManagerFactory emf) {

    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(emf);
    return transactionManager;
  }
Exemplo n.º 6
0
 @Qualifier("user_manager")
 @Bean(name = "user_manager_TransactionManager")
 public PlatformTransactionManager transactionManager() {
   final JpaTransactionManager transactionManager = new JpaTransactionManager();
   transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
   return transactionManager;
 }
Exemplo n.º 7
0
  @Bean
  public PlatformTransactionManager transactionManager() {
    final JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());

    return transactionManager;
  }
Exemplo n.º 8
0
  @Bean
  public JpaTransactionManager transactionManager() throws ClassNotFoundException {
    JpaTransactionManager transactionManager = new JpaTransactionManager();

    transactionManager.setEntityManagerFactory(entityManagerFactoryBean().getObject());

    return transactionManager;
  }
 @Bean(name = "transactionManager")
 public PlatformTransactionManager transactionManager(
     EntityManagerFactory entityManagerFactory, DataSource dataSource) {
   JpaTransactionManager transactionManager = new JpaTransactionManager();
   transactionManager.setEntityManagerFactory(entityManagerFactory);
   transactionManager.setDataSource(dataSource);
   return transactionManager;
 }
Exemplo n.º 10
0
 @Override
 @Bean
 @Primary
 public PlatformTransactionManager annotationDrivenTransactionManager() {
   JpaTransactionManager tm = new JpaTransactionManager();
   tm.setPersistenceUnitName("rgbycchPU");
   return tm;
 }
 /**
  * Transaction manager.
  *
  * @param dataSource
  * @param entityManagerFactory
  * @return transaction manager
  */
 @Bean(name = "txManager")
 public JpaTransactionManager jpaTransactionManager(
     DataSource dataSource, EntityManagerFactory entityManagerFactory) {
   JpaTransactionManager tm = new JpaTransactionManager();
   tm.setDataSource(dataSource);
   tm.setEntityManagerFactory(entityManagerFactory);
   return tm;
 }
Exemplo n.º 12
0
 @Bean
 @Autowired
 public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
   JpaTransactionManager txManager = new JpaTransactionManager();
   JpaDialect jpaDialect = new HibernateJpaDialect();
   txManager.setEntityManagerFactory(entityManagerFactory);
   txManager.setJpaDialect(jpaDialect);
   return txManager;
 }
Exemplo n.º 13
0
  @Bean
  public PlatformTransactionManager transactionManager() throws ClassNotFoundException {

    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(entityManagerFactory());
    transactionManager.setDataSource(dataSource());

    return transactionManager;
  }
Exemplo n.º 14
0
  @Override
  public void update(Artifact artifact) {

    logger.info("update()");

    TransactionStatus status =
        transactionManager.getTransaction(new DefaultTransactionDefinition());
    em.persist(em.merge(artifact));
    transactionManager.commit(status);
  }
Exemplo n.º 15
0
  @Override
  public void delete(Artifact artifact) {

    logger.info("delete(Artifact(" + artifact.getId() + "))");

    TransactionStatus status =
        transactionManager.getTransaction(new DefaultTransactionDefinition());
    em.remove(em.merge(artifact));
    transactionManager.commit(status);
  }
  @Bean
  @Autowired
  public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {

    JpaTransactionManager transactionManager = new JpaTransactionManager();

    transactionManager.setEntityManagerFactory(emf);

    return transactionManager;
  }
Exemplo n.º 17
0
  @Override
  public void delete(Long id) {

    logger.info("delete(" + id + ")");

    TransactionStatus status =
        transactionManager.getTransaction(new DefaultTransactionDefinition());
    em.createNamedQuery(Artifact.Q_DELETE_BY_ID, Artifact.class)
        .setParameter("id", id)
        .executeUpdate();
    transactionManager.commit(status);
  }
  @Override
  protected void doBegin(final Object transaction, final TransactionDefinition definition) {
    JdbcTransactionObjectSupport txObject = (JdbcTransactionObjectSupport) transaction;

    try {
      super.doBegin(transaction, definition);
    } catch (TransactionException ex) {
      rollbackAfterFailedBegin(txObject);
      throw ex;
    } catch (Exception ex) {
      rollbackAfterFailedBegin(txObject);
      throw new CannotCreateTransactionException(
          "Could not open JPA EntityManager for transaction", ex);
    }
  }
  public void initStartDisposeAndLoadSession() {
    try {
      EntityManager em = txm.getEntityManagerFactory().createEntityManager();
      // create new ksession with kstore
      KieSession ksession = kstore.newKieSession(kbase, null, getEnvironment());
      sessionId = ksession.getId();

      logger.info("\n\tSession id: " + sessionId + "\n");

      ksession.getWorkItemManager().registerWorkItemHandler("testWorkItemHandler", workItemHandler);

      ksession.startProcess("timer-flow", null);
      Thread.sleep(4000);
      ksession.dispose();
    } catch (Exception ex) {
      throw new IllegalStateException("The endTheProcess method has been interrupted", ex);
    }
  }
  @Override
  protected void doCleanupAfterCompletion(final Object transaction) {
    try {
      super.doCleanupAfterCompletion(transaction);
    } finally {
      JdbcTransactionObjectSupport transactionObj = (JdbcTransactionObjectSupport) transaction;
      EntityManager em = _newTransactionObjects.remove(transactionObj);

      if (em != null) {
        EntityManagerHolder holder =
            (EntityManagerHolder)
                TransactionSynchronizationManager.unbindResource(getEntityManagerFactory());
        LOGGER.debug(
            "doCleanupAfterCompletion() unbound holder [{}] and removed transactionObj [{}]",
            holder,
            transactionObj);
      }
    }
  }
Exemplo n.º 21
0
 @Bean()
 public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
   JpaTransactionManager retVal = new JpaTransactionManager();
   retVal.setEntityManagerFactory(entityManagerFactory);
   return retVal;
 }
Exemplo n.º 22
0
 /**
  * Configures default JPA transaction behavior.
  *
  * @return PlatformTransactionManager
  * @see PlatformTransactionManager
  */
 @Bean
 public PlatformTransactionManager transactionManager() {
   JpaTransactionManager txm = new JpaTransactionManager();
   txm.setEntityManagerFactory(entityManagerFactory().getObject());
   return txm;
 }
 public SpringJPAPersistenceManager(
     JpaTransactionManager transactionManager, TideTransactionManager tm) {
   super(transactionManager.getEntityManagerFactory(), tm);
 }
Exemplo n.º 24
0
 @Bean
 public JpaTransactionManager transactionManager() throws URISyntaxException {
   JpaTransactionManager transactionManager = new JpaTransactionManager();
   transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
   return transactionManager;
 }
Exemplo n.º 25
0
 @Bean(name = "transactionManager")
 public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
   JpaTransactionManager transactionManager = new JpaTransactionManager();
   transactionManager.setEntityManagerFactory(emf);
   return transactionManager;
 }
Exemplo n.º 26
0
 @Bean
 JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
   JpaTransactionManager transactionManager = new JpaTransactionManager();
   transactionManager.setEntityManagerFactory(entityManagerFactory);
   return transactionManager;
 }
Exemplo n.º 27
0
 @Bean
 public PlatformTransactionManager transactionManager(final EntityManagerFactory emf) {
   final JpaTransactionManager transactionManager = new JpaTransactionManager();
   transactionManager.setEntityManagerFactory(emf);
   return transactionManager;
 }
 @Bean(name = "transactionManager")
 public PlatformTransactionManager transactionManager() {
   JpaTransactionManager transactionManager = new JpaTransactionManager();
   transactionManager.setEntityManagerFactory(entityManagerFactoryBean().getObject());
   return transactionManager;
 }
Exemplo n.º 29
0
 protected PlatformTransactionManager createTransactionManager() {
   JpaTransactionManager tm = new JpaTransactionManager(getEntityManagerFactory());
   tm.afterPropertiesSet();
   return tm;
 }
Exemplo n.º 30
0
 public static PlatformTransactionManager createTransactionManager(
     EntityManagerFactory entityManagerFactory) {
   JpaTransactionManager tm = new JpaTransactionManager();
   tm.setEntityManagerFactory(entityManagerFactory);
   return tm;
 }