Package org.springframework.transaction

Examples of org.springframework.transaction.TransactionStatus


    LocalContainerEntityManagerFactoryBean cefb = parseValidPersistenceUnit();

    JpaTransactionManager jpatm = new JpaTransactionManager();
    jpatm.setEntityManagerFactory(cefb.getObject());

    TransactionStatus txStatus = jpatm.getTransaction(new DefaultTransactionAttribute());

    EntityManagerFactory emf = cefb.getObject();
    assertSame("EntityManagerFactory reference must be cached after init", emf, cefb.getObject());

    assertNotSame("EMF must be proxied", mockEmf, emf);
View Full Code Here


    LocalContainerEntityManagerFactoryBean cefb = parseValidPersistenceUnit();

    JpaTransactionManager jpatm = new JpaTransactionManager();
    jpatm.setEntityManagerFactory(cefb.getObject());

    TransactionStatus txStatus = jpatm.getTransaction(new DefaultTransactionAttribute());

    EntityManagerFactory emf = cefb.getObject();
    assertSame("EntityManagerFactory reference must be cached after init", emf, cefb.getObject());

    assertNotSame("EMF must be proxied", mockEmf, emf);
View Full Code Here

    pui.setTransactionType(PersistenceUnitTransactionType.JTA);

    JpaTransactionManager jpatm = new JpaTransactionManager();
    jpatm.setEntityManagerFactory(cefb.getObject());

    TransactionStatus txStatus = jpatm.getTransaction(new DefaultTransactionAttribute());

    EntityManagerFactory emf = cefb.getObject();
    assertSame("EntityManagerFactory reference must be cached after init", emf, cefb.getObject());

    assertNotSame("EMF must be proxied", mockEmf, emf);
View Full Code Here

            //need to propagate any exceptions back to Spring container
            //so transactions can occur
            if (inMessage.getContent(Exception.class) != null && session != null) {
                PlatformTransactionManager m = jmsConfig.getTransactionManager();
                if (m != null) {
                    TransactionStatus status = m.getTransaction(null);
                    JmsResourceHolder resourceHolder =
                        (JmsResourceHolder) TransactionSynchronizationManager
                            .getResource(jmsConfig.getConnectionFactory());
                    boolean trans = resourceHolder == null
                        || !resourceHolder.containsSession(session);
                    if (status != null && !status.isCompleted() && trans) {
                        Exception ex = inMessage.getContent(Exception.class);
                        if (ex.getCause() instanceof RuntimeException) {
                            throw (RuntimeException)ex.getCause();
                        } else {
                            throw new RuntimeException(ex);
View Full Code Here

            //need to propagate any exceptions back to Spring container
            //so transactions can occur
            if (inMessage.getContent(Exception.class) != null && session != null) {
                PlatformTransactionManager m = jmsConfig.getTransactionManager();
                if (m != null) {
                    TransactionStatus status = m.getTransaction(null);
                    JmsResourceHolder resourceHolder =
                        (JmsResourceHolder) TransactionSynchronizationManager
                            .getResource(jmsConfig.getConnectionFactory());
                    boolean trans = resourceHolder == null
                        || !resourceHolder.containsSession(session);
                    if (status != null && !status.isCompleted() && trans) {
                        Exception ex = inMessage.getContent(Exception.class);
                        if (ex.getCause() instanceof RuntimeException) {
                            throw (RuntimeException)ex.getCause();
                        } else {
                            throw new RuntimeException(ex);
View Full Code Here

  public void testOutboundWithCommit() throws Exception {
    //Send the message in a JTA transaction
    DefaultTransactionDefinition definition=new DefaultTransactionDefinition();
    definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status=null;
    try {
      status=transactionManager.getTransaction(definition);
      JmsTemplate template=new JmsTemplate(getConnectionFactory());
      template.convertAndSend(queue,TEST_MESSAGE);
      transactionManager.commit(status);
View Full Code Here

  public void testOutboundWithRollback() throws Exception {
    //Send the message in a JTA transaction
    DefaultTransactionDefinition definition=new DefaultTransactionDefinition();
    definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status=null;
    try {
      status=transactionManager.getTransaction(definition);
      JmsTemplate template=new JmsTemplate(getConnectionFactory());
      template.convertAndSend(queue,TEST_MESSAGE);
      transactionManager.rollback(status);
View Full Code Here

  public void testOutboundWithCommit() throws Exception {
    //Update the field in a JTA transaction
    DefaultTransactionDefinition definition=new DefaultTransactionDefinition();
    definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status=null;
    try {
      status=transactionManager.getTransaction(definition);
      JdbcTemplate template=new JdbcTemplate(getDataSource());
      template.update(UPDATE_FIELD_REQUEST,
          new Object[] {TEST_FIELD_VALUE,new Integer(FIELD_ID)},
View Full Code Here

  public void testOutboundWithRollback() throws Exception {
    //Update the field in a JTA transaction
    DefaultTransactionDefinition definition=new DefaultTransactionDefinition();
    definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status=null;
    try {
      status=transactionManager.getTransaction(definition);
      JdbcTemplate template=new JdbcTemplate(getDataSource());
      template.update(UPDATE_FIELD_REQUEST,
          new Object[] {TEST_FIELD_VALUE,new Integer(FIELD_ID)},
View Full Code Here

  public void testOutboundWithCommit() throws Exception {
    //Update the field and send a JMS message in a JTA transaction
    DefaultTransactionDefinition definition=new DefaultTransactionDefinition();
    definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status=null;
    try {
      status=transactionManager.getTransaction(definition);

      //JDBC
      JdbcTemplate jdbcTemplate=new JdbcTemplate(getDataSource());
View Full Code Here

TOP

Related Classes of org.springframework.transaction.TransactionStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.