rollback

EJB3 transaction rollback

老子叫甜甜 提交于 2019-12-02 18:54:06
I'm using CMT in EJB3 state-less session beans. Also I've created my own Exception having the annotation "@ApplicationException (rollback=true)". Do I have to use "context.setRollbackOnly()" when I want to rollback the transaction? Can I just rollback the transaction by throwing an exception inside public method in the bean? If so (the answer to Q#2 is yes) do I have to throw the exception out of the method by declaring the exception in the method or will it be sufficient to just throw an exception inside the method and handle it inside the same method itself? (I don't want to propagate the

What is the meaning of revert this commit and roll back this commit in GitHub for Windows?

依然范特西╮ 提交于 2019-12-02 17:51:59
Github for Windows features these two commands described as: revert this commit - create a new commit that reverts the changes of this commit rollback this commit - roll back this commit leaving all changes made in this and later commits in your working directory Could you explain the exact meaning of these two commands and how they can be used. Specifically I fail to understand what is the purpose of the second one. It makes no sense to me. Is it possible to revert to a previous commit check it out and if I don't like it, go back to where it was initially? This gui seems to feature a very

PDO Multiple queries: commit and rollback transaction

邮差的信 提交于 2019-12-02 15:37:36
问题 I need to fire 2 queries. currently I'm doing it like this: // Begin Transaction $this->db->beginTransaction(); // Fire Queries if($query_one->execute()){ if($query_two->execute()){ // Commit only when both queries executed successfully $this->db->commit(); }else{ $this->db->rollback(); } }else{ $this->db->rollback(); } Is this the correct approach? I'm not using any try..catch in my code will it make my code inappropriate or vulnerable for any situation? 回答1: Yes, your approach is correct.

What is the difference between rollback, backout and strip in the Mercurial Eclipse plugin?

夙愿已清 提交于 2019-12-02 15:24:29
What is the difference between the menu items rollback, backout and strip in the Mercurial Eclipse plugin? Can I delete the commit in the local repository without modify the files in my workspace with one of this 3 commands? Or is there another solution how I can commit and push a fix on another part of the project? My current work is not finish and I can not push it. But I must checkin a quick fix for another part of the project. The only solution that I see is to create a second workspace. But this look like a overkill for me. These commands all come from Mercurial itself, and there are

How to discard all changes made to a branch?

会有一股神秘感。 提交于 2019-12-02 13:53:35
I'm working in a branch (i.e. design ) and I've made a number of changes, but I need to discard them all and reset it to match the repository version. I thought git checkout design would do it, but it just tells me I'm already in branch design and that I have 3 modified files. How would I discard those changes and get the branch as it stands now on the remote server? Note: You CANNOT UNDO this. Try git checkout -f this will discard any local changes which are not committed in ALL branches and master. gor git reset --hard can help you if you want to throw away everything since your last commit

PDO Multiple queries: commit and rollback transaction

帅比萌擦擦* 提交于 2019-12-02 13:51:34
I need to fire 2 queries. currently I'm doing it like this: // Begin Transaction $this->db->beginTransaction(); // Fire Queries if($query_one->execute()){ if($query_two->execute()){ // Commit only when both queries executed successfully $this->db->commit(); }else{ $this->db->rollback(); } }else{ $this->db->rollback(); } Is this the correct approach? I'm not using any try..catch in my code will it make my code inappropriate or vulnerable for any situation? vhu Yes, your approach is correct. Using Try...catch may lead into cleaner and more readable code in some cases but your overall approach is

Exception not cuaght with Entity Manager

假如想象 提交于 2019-12-02 10:23:38
I have an Entity Manager in my EJB @PersistenceContext(unitName = "cnsbEntities") private EntityManager em; I populate an object and then I commit it in my DB, but if I have an exception, for duplicate ID, I can't catch it and I don't know why. try{ em.merge(boelLog); } catch (Exception e){ System.out.println("Generic Exception"); } JPA uses transactions to send entity modifications to the database. You can specify those transactions manually through Bean Managed Transactions (BMT) or let the application server do it for you (Container Managed Transactions; the default). So, you need to catch

Cancel previous operations in user defined function

别来无恙 提交于 2019-12-02 03:29:12
问题 Is it possible to cancel previous operations in a user defined function? For example: CREATE OR REPLACE FUNCTION transact_test () RETURNS BOOLEAN AS $$ BEGIN UPDATE table1 SET ... UPDATE table2 SET ... IF some_condition THEN --Here is possible to cancel all above operations? RETURN FALSE; END IF; RETURN TRUE; END; $$ LANGUAGE plpgsql; 回答1: Both answers so far are incorrect. If you try to start a transaction or use a SAVEPOINT inside a plpgsql function you get an error message like this: ERROR

Cancel previous operations in user defined function

拈花ヽ惹草 提交于 2019-12-01 23:01:31
Is it possible to cancel previous operations in a user defined function? For example: CREATE OR REPLACE FUNCTION transact_test () RETURNS BOOLEAN AS $$ BEGIN UPDATE table1 SET ... UPDATE table2 SET ... IF some_condition THEN --Here is possible to cancel all above operations? RETURN FALSE; END IF; RETURN TRUE; END; $$ LANGUAGE plpgsql; Both answers so far are incorrect. If you try to start a transaction or use a SAVEPOINT inside a plpgsql function you get an error message like this: ERROR: cannot begin/end transactions in PL/pgSQL HINT: Use a BEGIN block with an EXCEPTION clause instead.

TFS merge doesn't pick up rollback changeset(s)

霸气de小男生 提交于 2019-12-01 16:30:59
I've had the following TFS issue: I've created the new branch from MAIN branch. During the time some changesets (let specify them from CS-1 to CS-2) have happened on the new branch. In one moment I had modification on MAIN branch and this modification has been merged on the new branch (new changeset on branch: CS-3). After that, new branch was having several changes (which produced changesets from CS-4 to CS-5). Also, I did a rollback of CS-3 and as result the new changeset CS-6 has been created on the new branch. Now, the question is: Which changesets should be contained in merge from the new