transactions

Android: SQLite (ORMLite) transaction isolation levels

余生颓废 提交于 2019-12-19 03:21:36
问题 I'm using ORMLite in my Android project. I know that Sqlite takes care of the file level locking. Many threads can read, one can write. Locks prevent more than one writing. Could anybody please explain what will happen in case one thread is updating some record and another thread is trying to read this record? Will the thread (that is trying to read) get out-of-date data? Or will it be locked until the first thread completes its write-operation? As I know there are 4 transaction isolation

Yield return from a try/catch block [duplicate]

帅比萌擦擦* 提交于 2019-12-19 02:37:08
问题 This question already has answers here : yield return with try catch, how can i solve it (10 answers) Closed 6 years ago . As Eric Lippert described in this article, yield return is not allowed within try/catch clauses. Is there a nice way I could get something like this, without having to write my own IEnumerator by hand: public IEnumerable<Data> GetData() { var transaction = Session.BeginTransaction()); try { IQuery q = CreateQuery(session); foreach (var result in q.Enumerable()) yield

Does Liquibase support dry run?

♀尐吖头ヾ 提交于 2019-12-19 02:32:10
问题 We have couple of data schemas and we investigate the migration to Liquibase. (One of data schemas is already migrated to Liquibase). Important question for us is if Liquibase supports dry run: We need to run database changes on all schemas without commit to ensure we do not have problems. In case of success all database changes run once again with commit. (The question similar to this SQL Server query dry run but related to Liquibase) Added after the answer I read documentation related to

@Transactional (noRollbackFor=RuntimeException.class) does not prevent rollback on RuntimeException

有些话、适合烂在心里 提交于 2019-12-18 21:21:47
问题 @Transactional (noRollbackFor=RuntimeException.class) public void methodA (Entity e){ service.methodB(e); } ---service method below--- @Transactional (propagation=Propagation.REQUIRES_NEW, noRollbackFor=RuntimeException.class) public void methodB (Entity e){ dao.insert(e); } When dao.insert(e) in methodB() causes a primary key violation and throws a ConstraintViolationException , which is a subclass of RuntimeException , I would expect the transaction to still commit because of the

database lock issue in HTC Desire

南笙酒味 提交于 2019-12-18 18:25:47
问题 In my application one service is getting data from server and inserting it to table A . If I go to particular UI, I need to list data from another table B if background operation is doing it will generate database locked exception. I got two database operation done in parallel each on two different table. It is working fine in samsung gt15801. But htc desire it will generate database locked error. HTC desire - insertion process takes 91 seconds. Samsung gt15801 - insertion process takes 21

How manage transaction between domain logic and events in DDD?

允我心安 提交于 2019-12-18 16:56:52
问题 I am studying on the programming in DDD and event source. I saw one example that when a domain logic was called (e.g. Order.placeOrder() ) it would publish an event (e.g. OrderPlaced ). And the event would be sent to MQ as the event store. The domain logic ( Order.placeOrder() ) should be an atomic API, and it should have @Transactional annotation if using Spring for the transaction manager. And now my question is: How to make sure the DB change and event sending are within the same

Deadlock on SELECT/UPDATE

末鹿安然 提交于 2019-12-18 16:30:07
问题 I'm having a problem with deadlock on SELECT/UPDATE on SQL Server 2008. I read answers from this thread: SQL Server deadlocks between select/update or multiple selects but I still don't understand why I get deadlock. I have recreated the situation in the following testcase. I have a table: CREATE TABLE [dbo].[SessionTest]( [SessionId] UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL, [ExpirationTime] DATETIME NOT NULL, CONSTRAINT [PK_SessionTest] PRIMARY KEY CLUSTERED ( [SessionId] ASC ) WITH ( PAD_INDEX

Deadlock on SELECT/UPDATE

对着背影说爱祢 提交于 2019-12-18 16:30:01
问题 I'm having a problem with deadlock on SELECT/UPDATE on SQL Server 2008. I read answers from this thread: SQL Server deadlocks between select/update or multiple selects but I still don't understand why I get deadlock. I have recreated the situation in the following testcase. I have a table: CREATE TABLE [dbo].[SessionTest]( [SessionId] UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL, [ExpirationTime] DATETIME NOT NULL, CONSTRAINT [PK_SessionTest] PRIMARY KEY CLUSTERED ( [SessionId] ASC ) WITH ( PAD_INDEX

@Transactional in Spring+Hibernate

血红的双手。 提交于 2019-12-18 16:08:16
问题 I an using Spring 3.1 + Hibernate 4.x in my web application. In my DAO, i am saving User type object as following sessionFactory.getCurrentSession().save(user); But getting following exception: org.hibernate.HibernateException: save is not valid without active transaction I googled and found similar question on SO, with following solution: Session session=getSessionFactory().getCurrentSession(); Transaction trans=session.beginTransaction(); session.save(entity); trans.commit(); That solves

Why nested transactions are not supported in JTA

旧城冷巷雨未停 提交于 2019-12-18 15:41:06
问题 Why aren't nested transactions supported by JTA? Is it because of the complexity of implementing them (which I doubt) or some design principle? 回答1: (As @Piotr Nowicki points out, JTA does allow nested transactions, but this is optional not mandatory.) Why? This is one of those questions that is impossible to answer with any certainty, unless you were one of the people "in the room" when the decisions were made. It could be the inherent complexity of including nested transactions as part of