transactions

Real world example of application of the command pattern

ぃ、小莉子 提交于 2020-01-01 04:40:09
问题 Command pattern can be used to implement Transactional behavior (and Undo ). But I could not find an example of these by googling. I could only find some trivial examples of a lamp that is switched on or off . Where can I find a coding example (preferably in Java )of this/these behaviors implemented using the Command Pattern ? 回答1: In one of our projects, we have the following requirement: Create a record in DB. Call a service to update a related record. Call another service to log a ticket.

JpaTransactionManager transactions not used by Hibernate Session

江枫思渺然 提交于 2020-01-01 02:46:45
问题 I am working on a project that is using Spring framework (4.3.3.RELEASE) and Hibernate (5.2.3.Final) and I am starting to move to using Spring Data JPA. I have just migrated the LocalSessionFactoryBean with HibernateTransactionManager config to using the JPA config of LocalContainerEntityManagerFactoryBean with JpaTransactionManager with HibernateJpaSessionFactoryBean . The existing hibernate code that uses Session s from SessionFactory s seemed to work fine until I tested some code that does

EJB3 - using 2 persistence units within a transaction (Exception: Local transaction already has 1 non-XA Resource)

烂漫一生 提交于 2020-01-01 02:45:28
问题 I am trying to use 2 persistence units within the same transaction in a Java EE application deployed on Glassfish. The 2 persistence units are defined in persistence.xml, as follows: <persistence-unit name="BeachWater"> <jta-data-source>jdbc/BeachWater</jta-data-source> ... <persistence-unit name="LIMS"> <jta-data-source>jdbc/BeachWaterLIMS</jta-data-source> ... These persistence units correspond to JDBC resources and connection pools which I had defined in Glassfish as follows (include one

MySQLi Prepared Statements and Transactions

China☆狼群 提交于 2019-12-31 22:22:15
问题 Is there a way to do transactions with prepared statements? I mean can I use the following example with $mysqli->autocommit(FALSE); and $mysqli->commit( ); and $mysqli->rollback( ); //Preparing the statment $insert_stmt=$mysqli->prepare("INSERT INTO x VALUES(?,?)") or die($mysqli->error); //associate variables with the input parameters $insert_stmt->bind_param("is", $my_number,$my_string); //i=integer //Execute the statement multiple times.... for ($my_number = 1; $my_number <= 10; $my_number

When should I consider using a in memory database and what are the issue to look out for?

有些话、适合烂在心里 提交于 2019-12-31 17:54:15
问题 I was just think that now it is common to have enough RAM on your database server to cache your complete database why are the specialist in memory database (e.g TimesTen, see also Wikipedia page) that were all the rage a few years ago not being used more? It seems to be that as time go on, none disk based databases are being used less, e.g most applications are now built on conventional rational databases. I would have expected the opposite as RAM is getting close to being free for a lot of

When should I consider using a in memory database and what are the issue to look out for?

旧时模样 提交于 2019-12-31 17:53:19
问题 I was just think that now it is common to have enough RAM on your database server to cache your complete database why are the specialist in memory database (e.g TimesTen, see also Wikipedia page) that were all the rage a few years ago not being used more? It seems to be that as time go on, none disk based databases are being used less, e.g most applications are now built on conventional rational databases. I would have expected the opposite as RAM is getting close to being free for a lot of

Capybara+Selemium: How to initialize database in an integration test code and make it visible in Rails application?

血红的双手。 提交于 2019-12-31 12:59:14
问题 Configuration: Integration tests for Rails project using RSpec, Capybara, Selemium driver, SQLite database. Situation: I had few integration tests with Capybara and default rack_test driver. They create a user registration (for Devise gem) directly in database. Then they login and test a scenario using Capybara DSL like a user would do. Problem: I tried to change a driver to Selenium to test JavaScript code as well. Now the tests fail because application does not see a user registration that

How to rollback nested transactions with Propagation.REQUIRES_NEW in integration tests

丶灬走出姿态 提交于 2019-12-31 10:33:09
问题 I have several integration tests for various services that extend the following baseclass: @ContextConfiguration(locations="classpath:applicationContext-test.xml") @TransactionConfiguration(transactionManager="txManager", defaultRollback=true) @Transactional public abstract class IntegrationTestBase extends AbstractTransactionalJUnit4SpringContextTests { //Some setup, filling test data to a HSQLDB-database etc } For most cases this works fine, but I have a service class which has transactions

Oracle Accessing updated records during the same transaction

倖福魔咒の 提交于 2019-12-31 07:34:23
问题 Using Oracle 10g Is it possible to get the value of a newly updated field within the same transaction before it is committed. I am executing a stored procedure which calls 2 other stored procedures. The first stored procedure gets a record from a table and then updates that record. The second stored procedure gets that same record but needs to use the newly updated fields from the first stored procedure. Then the commit is carried out. The commit can only be done if both procedures are

Oracle Accessing updated records during the same transaction

99封情书 提交于 2019-12-31 07:34:17
问题 Using Oracle 10g Is it possible to get the value of a newly updated field within the same transaction before it is committed. I am executing a stored procedure which calls 2 other stored procedures. The first stored procedure gets a record from a table and then updates that record. The second stored procedure gets that same record but needs to use the newly updated fields from the first stored procedure. Then the commit is carried out. The commit can only be done if both procedures are