transactions

Entity framework 6 usetransaction databasefirst throws UnintentionalCodeFirstException

谁说我不能喝 提交于 2019-12-23 00:44:09
问题 I'm trying to execute the following : SqlConnection cnSql = new SqlConnection(cnstring); cnSql.Open(); SqlTransaction Transactie = default(SqlTransaction); Transactie = cnSql.BeginTransaction(); SqlCommand cmddelbonh = new SqlCommand(); cmddelbonh.Connection = Transactie.Connection; cmddelbonh.Transaction = Transactie; cmddelbonh.CommandText = "update artikelgroepen set OMSN='XXXXX' where ID = 3"; cmddelbonh.ExecuteNonQuery(); using (CXNACC_TESTFIRMA cxn = new CXNACC_TESTFIRMA(cnSql)) { cxn

How to comprehensively intercept Insert/Update/Delete DB Transactions in a Hibernate 4 application

帅比萌擦擦* 提交于 2019-12-22 22:16:23
问题 I created several similar threads about particular issues, but let me summarize the problem I'm facing more globally: GOAL Need to intercept all Insert/Update/Delete DB Transactions in an application written in Spring 4.1.5, Hibernate 4.3.8. The app uses all styles of Hibernate usage: Object-based through Session, e.g. sessionFactory.getCurrentSession().saveOrUpdate(obj); HQL executeUpdate, e.g. Query q = "update Obj ..."; q.executeUpdate(); Criteria API, e.g. Criteria q = sessionFactory

Postgresql: PREPARE TRANSACTION

时间秒杀一切 提交于 2019-12-22 19:14:41
问题 I've two DB servers db1 and db2. db1 has a table called tbl_album db2 has a table called tbl_user_album CREATE TABLE tbl_album ( id PRIMARY KEY, name varchar(128) ... ); CREATE TABLE tbl_user_album ( id PRIMARY KEY, album_id bigint ... ); Now if a user wants to create an album what my php code needs to do is: Create a record in db1 and save its id(primary key) Create a record in db2 using it saved in first statement Is it possible to keep these two statements in a transaction? I'm ok with a

Postgresql: PREPARE TRANSACTION

情到浓时终转凉″ 提交于 2019-12-22 19:14:12
问题 I've two DB servers db1 and db2. db1 has a table called tbl_album db2 has a table called tbl_user_album CREATE TABLE tbl_album ( id PRIMARY KEY, name varchar(128) ... ); CREATE TABLE tbl_user_album ( id PRIMARY KEY, album_id bigint ... ); Now if a user wants to create an album what my php code needs to do is: Create a record in db1 and save its id(primary key) Create a record in db2 using it saved in first statement Is it possible to keep these two statements in a transaction? I'm ok with a

Semantics of Oracle stored procedures / functions in a transactional context

情到浓时终转凉″ 提交于 2019-12-22 18:28:43
问题 I have recently had some input from a colleague regarding committing in a stored function. Whether we use procedures or functions to execute offline / batch logic in an Oracle database is mostly a matter of taste in our application. In both cases, we return a code either as function result, or as procedure OUT parameter. We usually require those offline / batch routines to be called from PL/SQL, not from SQL: -- good declare rc number(7); begin rc := our_function(1, 2, 3); end; -- less good

Could simultaneous transactions interfere with each other? php/mysql

て烟熏妆下的殇ゞ 提交于 2019-12-22 18:14:23
问题 So I found this example code and plan to do something like it for a project of mine but there's a concern that's bugging me try { // First of all, let's begin a transaction $db->beginTransaction(); // A set of queries; if one fails, an exception should be thrown $db->query('first query'); $db->query('second query'); $db->query('third query'); // If we arrive here, it means that no exception was thrown // i.e. no query has failed, and we can commit the transaction $db->commit(); } catch

How do I lock certain SQL rows while running a process on them?

怎甘沉沦 提交于 2019-12-22 17:56:05
问题 My work has a financial application, written in VB.NET with SQL , that several users can be working on at the same time. At some point, one user might decide to Post the batch of entries that they (and possibly other people) are currently working on. Obviously, I no longer want any other users to add , edit , or delete entries in that batch after the Post process has been initiated. I have already seen that I can lock all data by opening the SQL transaction the moment the Post process starts,

How to rollback nHibernate transaction when an exception occurs during request having Ninject for managing sessions?

浪子不回头ぞ 提交于 2019-12-22 14:53:51
问题 I use nHibernate for ORM and Ninject for IoC. I create nHibernate sessions per some custom scope (which you can assume is per request). I begin the transaction onActivation. I commit the transaction onDeactivation. The problem is that if an exception happens during the request I want to rollback the transaction rather than committing it. Any idea how to detect (in a clean way, most probably using Ninject Context) that an exception has happened? Note: I am not concerned about the exceptions

InnoDB deadlock with read-uncommited! - Java - Glassfish - EJB3 (JPA/Hibernate)

无人久伴 提交于 2019-12-22 13:50:22
问题 It's been several days that I got deadlock issues on a Java application with Glassfish - EJB3 with Mysql InnoDB Config: Mysql InnoDB: Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2 Application server: Glassfish v2.1 Persistence with EJB3 - JPA - Hibernate To make it simple I have - a SOA system with servlet that handle subscriptions of users to services, logon, logoff, payments and registration etc... - a quartz job system (cron triggers) that handle the daily

Google translator API using CURL post method

久未见 提交于 2019-12-22 13:12:49
问题 Did anyone have any experience in Google translator API v2 for translating HTML using PHP CURL on POST method? I have tried several codes and libraries from github, but none of them worded for me. What I have found is GET methods. Due to limitation for parsing data over GET or query string, I am unable to send large HTML data to translate. I am looking for a solution/snippets which can translate buffered data using using CURL 回答1: Here is my solution $handle = curl_init(); if (FALSE ===