transactions

how to change isolation level?

时光怂恿深爱的人放手 提交于 2021-02-07 14:13:57
问题 I am using EF 4.0, and I would like to use the isolation level serializable , because in a transaction I would like to block a register when is read. Well, in SQL Server I try to change the isolation level with this command: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; And in C# I use this code to try to block the register: using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.Serializable })) {

What is the default value of sqlite3_busy_timeout?

倾然丶 夕夏残阳落幕 提交于 2021-02-07 12:58:45
问题 This seems like it should be really easy to find out, but I don't see it documented anywhere. If I open a sqlite connection and begin a transaction without specifying a timeout by calling sqlite3_busy_timeout , what default value is used? Or will this somehow cause undefined behavior? The documentation of this method doesn't say. My specific use case is the version bundled with iOS, but I'm guessing the answer is pretty much the same across platforms. 回答1: If neither sqlite3_busy_timeout()

Combine inserts into one transaction Python SQLite3

百般思念 提交于 2021-02-07 12:45:17
问题 I am trying to input 1000's of rows on SQLite3 with insert however the time it takes to insert is way too long. I've heard speed is greatly increased if the inserts are combined into one transactions. However, i cannot seem to get SQlite3 to skip checking that the file is written on the hard disk. this is a sample: if repeat != 'y': c.execute('INSERT INTO Hand (number, word) VALUES (null, ?)', [wordin[wordnum]]) print wordin[wordnum] data.commit() This is what i have at the begining. data =

Setting constraint deferrable doesn't work on PostgreSQL transaction

喜你入骨 提交于 2021-02-07 11:31:47
问题 This is the situation: I have two tables where the one references the other (say, table2 references table1). When creating these tables, I did set the foreign key constraint as DEFERRABLE and the ON UPDATE and ON DELETE clauses as NO ACTION (which is the default). But still, when running the transaction below, I get the following error. Transaction: START TRANSACTION; SET CONSTRAINTS ALL DEFERRED; UPDATE table1 SET blah blah; UPDATE table2 SET blah blah; COMMIT; Error: ERROR: update or delete

Transactions between two replicating master mysql servers

我们两清 提交于 2021-02-07 09:16:00
问题 With a replicating mysql master to master database with innodb engine, if one transaction were to initiate on database A will that row lock for database B until the transaction has been committed? 回答1: The master getting the first transaction is completely separate from the second master and they communicate through a binary log. https://dev.mysql.com/doc/refman/5.7/en/replication-formats.html In the case of something requiring a transaction, then the actual statements are not written to the

Does committing transaction close session?

∥☆過路亽.° 提交于 2021-02-07 07:25:11
问题 I am new to hibernate. Does session.getTransaction().commit() , close the session? Because in the api documentation it is not mentioned that it closes the session. In my code I have session.getTransaction().commit(); session.close(); But I get following exception org.hibernate.SessionException: Session was already closed If I remove session.close() , then I do not get this exception. 回答1: You can find more info about it here. Basically, this depends on how you obtained the session and what is

@Transactional(readOnly = true) leads to LazyInitializationException

狂风中的少年 提交于 2021-02-07 06:29:05
问题 I have a many-to-many relation with an additional column in the link table. I've configured it in a way that the owning side fetches children eager (so I don't get LazyInitializationException ) and in the opposite direction it is lazy. This works. I now wanted to fine-tune the transactions (before there was just @Transactional on class level of DAO and Service classes. I set method getById to readOnly = true : @Transactional(readOnly = true) public Compound getById(Long id) { return

Spring Transactional Annotation

心已入冬 提交于 2021-02-07 06:17:16
问题 I'm trying to get a better handle on the use of Spring's @Transactional attribute. I understand that it basically wraps the contents of the method marked as @Transactional in a transaction. Would it be appropriate to mark a service/business layer method as transactional, as opposed to the actual DAO method, as I have done here? Service Implementation public class UserServiceImpl implements UserServiceInt{ @Autowired private UserServiceDAO serviceDAO; @Override public User getUser(int id){

Spring Transactional Annotation

会有一股神秘感。 提交于 2021-02-07 06:13:28
问题 I'm trying to get a better handle on the use of Spring's @Transactional attribute. I understand that it basically wraps the contents of the method marked as @Transactional in a transaction. Would it be appropriate to mark a service/business layer method as transactional, as opposed to the actual DAO method, as I have done here? Service Implementation public class UserServiceImpl implements UserServiceInt{ @Autowired private UserServiceDAO serviceDAO; @Override public User getUser(int id){

Spring Transactional Annotation

拥有回忆 提交于 2021-02-07 06:07:53
问题 I'm trying to get a better handle on the use of Spring's @Transactional attribute. I understand that it basically wraps the contents of the method marked as @Transactional in a transaction. Would it be appropriate to mark a service/business layer method as transactional, as opposed to the actual DAO method, as I have done here? Service Implementation public class UserServiceImpl implements UserServiceInt{ @Autowired private UserServiceDAO serviceDAO; @Override public User getUser(int id){