Spring @Transactional read-only propagation

First of all, since Spring doesn’t do persistence itself, it cannot specify what readOnly should exactly mean. This attribute is only a hint to the provider, the behavior depends on, in this case, Hibernate. If you specify readOnly as true, the flush mode will be set as FlushMode.NEVER in the current Hibernate Session preventing the … Read more

Database.BeginTransaction vs Transactions.TransactionScope [duplicate]

I found out the answer in Entity Framework 6’s documentation: With the introduction of EF6, Microsoft recommends to use new API methods: Database.BeginTransaction() and Database.UseTransaction(). Although System.Transactions.TransactionScope is still very well supported, it is no longer necessary for most users of EF6. While Database.BeginTransaction() is used only for database related operations transaction, System.Transactions.TransactionScope, in addition … Read more

Should I commit or rollback a read transaction?

You commit. Period. There’s no other sensible alternative. If you started a transaction, you should close it. Committing releases any locks you may have had, and is equally sensible with ReadUncommitted or Serializable isolation levels. Relying on implicit rollback – while perhaps technically equivalent – is just poor form. If that hasn’t convinced you, just … Read more

How does TransactionScope roll back transactions?

Essentially TransactionScope doesn’t track your Adapter’s, what it does is it tracks database connections. When you open a DB connection the connections will looks if there is an ambient transaction (Transaction Scope) and if so enlist with it. Caution if there are more the one connection to the same SQL server this will escalate to … Read more

How to display open transactions in MySQL

How can I display these open transactions and commit or cancel them? There is no open transaction, MySQL will rollback the transaction upon disconnect. You cannot commit the transaction (IFAIK). You display threads using SHOW FULL PROCESSLIST See: http://dev.mysql.com/doc/refman/5.1/en/thread-information.html It will not help you, because you cannot commit a transaction from a broken connection. What … Read more

Is it possible to roll back CREATE TABLE and ALTER TABLE statements in major SQL databases?

http://wiki.postgresql.org/wiki/Transactional_DDL_in_PostgreSQL:_A_Competitive_Analysis provides an overview of this issue from PostgreSQL’s perspective. Is DDL transactional according to this document? PostgreSQL – yes MySQL – no; DDL causes an implicit commit Oracle Database 11g Release 2 and above – by default, no, but an alternative called edition-based redefinition exists Older versions of Oracle – no; DDL causes an … Read more

Transaction marked as rollback only: How do I find the cause

When you mark your method as @Transactional, occurrence of any exception inside your method will mark the surrounding TX as roll-back only (even if you catch them). You can use other attributes of @Transactional annotation to prevent it of rolling back like: @Transactional(rollbackFor=MyException.class, noRollbackFor=MyException2.class)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)