O GoConqr está de visual novo! Conte para nós o que você achou.

Mapa mental

Transactions

Felipe Malfatti Português

Conteúdo do mapa

Transactions

  1. @Transactional

    • Propagation Type
      • MANDATORY
        • Support a current transaction, throw an exception if none exists.
      • NESTED
        • Execute within a nested transaction if a current transaction exists
      • NEVER
        • throw an exception if a transaction exists.
      • NOT_SUPPORTED
        • suspend the current transaction if one exists.
      • REQUIRED
        • Support a current transaction, create a new one if none exists.
      • REQUIRES_NEW
        • Create a new transaction, and suspend the current transaction if one exists.
      • SUPPORTS
        • Support a current transaction, execute non-transactionally if none exists.
    • Isolation Level
      • DEFAULT
      • READ_COMMITTED
        • keeps write locks
        • Locks are released as soon as the SELECT operation is performed
        • range-locks are not managed
        • Restricts dirty read
      • READ_UNCOMMITTED
        • lowest isolation level
        • may see not-yet-committed changes made by other transactions.
      • REPEATABLE_READ
        • keeps read and write locks
        • range-locks are not managed
      • SERIALIZABLE
        • This is the highest isolation level.
        • requires read and write locks
        • Also range-locks must be acquired
        • Phantom reads doesnt ocurrs
    • Time out
    • readOnly flag
      • Optimization in some cases
        • when you are using Hibernate
      • Provide safe guard
        • Oracle and some other databases
    • Rollback rules
    • by default, rollback happens for unchecked exceptions only (Runtime)
    • Spring create a proxy for this class
      • To inject transactional logic before and after the method being invoked
      • if the bean is implementing an interface
        • any self-invocation calls will not start any transaction
          • even if the method is annotated with @Transactional.
    • <tx:annotation-driven />
      • Enables Transactions
  2. Global Transactions

    • work with multiple transactional resources
      • Multiples Databases?
  3. Local Transactions

    • Local transactions are resource-specific
      • JDBC connection
  4. PlatformTransactionManager (Interface)

    • commit(TransactionStatus ts)
    • rollback(TransactionStatus status)
    • TransactionStatus getTransaction(TransactionDefinition definition)
    • throw a TransactionException
      • RuntimeException
  5. TransactionTemplate

    • Is a template emplates such as the JdbcTemplate
    • Need a TransactionCallback implementation
      • will contain code that you need to have execute in the context of a transaction
    • Propagation mode, the isolation level, the timeout, can be set programmatically
      • Or in configuration
    • they are threadsafe
    • Simplifies programmatic transaction demarcation and transaction exception handling.
    • the central method is execute(TransactionalCallback)
  6. Spring AOP is used to apply the transaction

    • if an target method1, calling an method2 directly in the target object
      • will not be applied by the proxy to the method2

Informações

Descrição
Mapa Mental sobre Transactions, criado por Felipe Malfatti em 17-04-2018.
Criado por
Felipe Malfatti
Visualizações
0
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?