Transaction - the subprocess rolling back parent JTA
According to Oracle documentation,
"if the caller partner link specifies transaction=participate and the subprocess also specifies transaction=participate, the subprocess rolls back the client JTA transaction."
But what I experience is if I just set transaction=participate for the partner link alone (and not having transaction=participate in the subprocess), when the subprocess rolls back, it rolls back parent JTA transaction also.
In fact, if we have just transaction=participate for the partner link (and not having transaction=participate in the subprocess), then the rollback in either Parent or Subprocess, is rolling back both Parent and Subprocess.
Can somebody provide the exact usage of using transaction=participate at the subprocess level?
Thanks,
Joe
Joe,
You are seeing expected behaviour. Even though both flags are called "transaction" and both are set to "participate", they do different things.
By specifying transaction=participate on the partner link, you are instructing the subprocess to enlist in the transaction. When the subprocess starts, it will then enlist itself. That's all. Now if a rollback occurs, all participating processes will be rolled back.
If you specify transaction=participate at the process level, it has a different effect, and doesn't affect whether or not the transaction is rolled back or not. As I said in the previous paragraph, if the partner link specified transaction=participate, the subprocess will roll back if a rollback is issued, no matter what other settings you have.
So what effect does that setting have at the process level? According to the doc:
When transaction=participate, the process produces a fault that is not handled by fault handlers, which calls the transaction to be rolled back.
This is not exactly crystal clear, to me, anyway. In practice if this is set and your subprocess throws an unhandled fault, it triggers a rollback instead of throwing a fault as it normally would. This exception goes immediately back to the calling process since it is participating on the transaction as well.
If the property is not set, and the subprocess throws an unhandled fault, you get the normal behavior. Namely, the process will be flagged as faulted, and the calling process will wait until it gets a transaction timeout (no relation to the JTA transaction we're talking about here).
It's a simple test. Create two processes, then run it twice. Once with that property set, and one without.
The key is to remember that although they are both called "transaction=participate", the effect they have is very different. It was probably not a good move to use the same name and value like that. Hope this helps.
Regards,
Robin.
Similar Messages
-
MDB transaction getting silently rolled back?
I have an MDB that is doing a delete of a database record in the onMessage method.
It seems to work fine. I see no errors in the log, in fact I have some debug
statements that indicate everything was completed normally. I even do a count
sql using the same where clause and print the results and see a '0'.
However, when I check the database, the record is still there.
It seems as if the transaction is getting rolled back somehow. The MDB is transaction
required/container tx. I never setRollbackOnly anywhere.
The topic was originally published in a transaction that was rolled back, if that
makes any difference. In fact, the point of the MDB is to clean up a record that
was created during the transaction but not within the transaction.
Any help is appreciated!
ken
It turned out that the MDB was using a different connection pool than it should
have, which was pointed to an old copy of the database. So it wasn't really rolling
back, it really was deleting records as desired, just in the wrong database.
Thanks
ken
Tom Barnes <[email protected].bea.com>
wrote:
>Some random ideas:
>
>Is the app sending a delete request to the MDB, and
>the MDB acting on it, before the record is even inserted?
>
>Does the delete request have the correct row-id/PK?
>
>Is the MDB app failing without your knowledge? You
>can instrument the MDB onMessage() with a
>"try catch Throwable" to see.
>
>Is the MDB tx timing out trying to get a lock
>on the row? You can instrument the onMessage
>with timestamps to see if its taking longer than 30 seconds...
>
>Tom
>
>Ken Clark wrote:
>
>> I have an MDB that is doing a delete of a database record in the onMessage
>method.
>> It seems to work fine. I see no errors in the log, in fact I have
>some debug
>> statements that indicate everything was completed normally. I even
>do a count
>> sql using the same where clause and print the results and see a '0'.
>>
>> However, when I check the database, the record is still there.
>>
>> It seems as if the transaction is getting rolled back somehow. The
>MDB is transaction
>> required/container tx. I never setRollbackOnly anywhere.
>>
>> The topic was originally published in a transaction that was rolled
>back, if that
>> makes any difference. In fact, the point of the MDB is to clean up
>a record that
>> was created during the transaction but not within the transaction.
>>
>> Any help is appreciated!
>>
>> ken
>
-
Statement in Transaction Does Not Roll Back
I have a group of MySQL statements in a method of a Java application.
I include an SQL error in the last statement to test the rollback of the transaction.
All the statements roll back, EXCEPT for the one detailed below.
The MySQL table:
CREATE TABLE Counter (
number INT( 4 ) NOT NULL DEFAULT 0,
account_id VARCHAR( 12 ) NOT NULL PRIMARY KEY
) ENGINE = InnoDB;I have run the staement as a PreparedStatement and a Statement:
PreparedStatement:
String updateCounterStr =
" UPDATE Counter " +
" SET number = number + 1 " +
" WHERE account_id = ? "
updateCounter = con.prepareStatement ( updateCounterStr );
updateCounter.setString( 1, accountID );
int uc = updateCounter.executeUpdate(); Statement:
Statement updateCounterStatement = con.createStatement();
int updatecounter = updateCounterStatement.executeUpdate(
"UPDATE Counter SET number = number + 1 " +
"WHERE account_id = \'" + accountID + "\'"
con.setAutoCommit( true ); // ------------------------------------ Transaction ENDS
updateCounterStatement.close();
// updateCounter.close();
... several more
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
if (con != null) {
try {
System.err.print("Transaction is being ");
System.err.println("rolled back");
con.rollback(); // < ------------------------------------ con.rollback() HERE
} catch(SQLException excep) {
System.err.print("SQLException: ");
System.err.println(excep.getMessage());
} // ---------------------------------------- END the methodIn both cases Counter is incremented, but does NOT roll back.
The other statements in the transaction do roll back,
I am using:
mysql Ver 14.12 Distrib 5.0.18, for apple-darwin8.2.0 (powerpc) using readline 5.0
on Mac OS X 10.4.x
I would greatly appreciate a solution to this problem.
Many thanks in advanceI think autocommit is true by default. Also, it looks like your'e setting it to true, and then executing more SQL.
Explicitly set it to false, and DON'T set it back to trueif there's any chance you're going to want to rollback after that. -
Transaction is not Rolling Back in Stateless Session Bean
Hi,
I am using UserTransaction in Stateless Session bean .
Transaction is not rolling back.
The following code is writen in stateless session bean. In UserTransaction i am
calling Two methods of another stateless session bean.
The problem is if doJob2() method fails, doJob1() method is rolling back. These
two methods consist of SQL statement with different Connection Object from TXDataSource.And
session bean(TestSession) is set to CMT, attribute as "Required".
try{
Context ictx=new InitialContext();
TestHome home=(TestHome)ictx.lookup("TestSession");
utx = sessionCtx.getUserTransaction();
utx.begin();
TestRemote remote=home.create();
remote.doJob1();
remote.doJob2();
utx.commit();
}catch(Exception e)
try{
utx.rollback();
}catch(Exception ex)
System.out.println("unable to rollback"+ex);
if any SQL Exception as occured in doJob2(), its calling method utx.rollback()
in catch block. but SQL statements executed thru. doJob1() are not rolling back.
what might be the reason?
thanks
Ranganath
Thanx Priscilla ,
Transaction is working.
ranganath
"Priscilla Fung" <[email protected]> wrote:
>
>In your ejb-jar.xml, you should specify <transaction-type> element to
>be "Container"
>for container-managed transaction. If you specified it to be "Bean" for
>bean-managed
>transaction, EJB ontainer will suspend the caller's transaction before
>starting
>a new transaction for your doJobX() methods. Thus, doJob1()nd doJob2()
>will be
>executing in different transactions, and thus rolling back doJob2()'s
>transaction
>will have no effect on work done and committed in doJob1()'s transaction.
>
>Regards,
>
>Priscilla
>
>
>"Ranganath" <[email protected]> wrote:
>>
>>
>>
>>I am sending config.xml,deployment descriptors, code snippet for TestSession.
>>i
>>am using weblogic6.0sp2.
>>if you need any aditional info. please let me know.
>>
>>thanks
>>ranganath
>>
>>EJB-JAR.xml
>>
>><?xml version="1.0"?>
>>
>><!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise
>JavaBeans
>>1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
>>
>><ejb-jar>
>> <enterprise-beans>
>> <session>
>> <ejb-name>TestSession</ejb-name>
>> <home>com.apar.sslbridge.test.TestHome</home>
>> <remote>com.apar.sslbridge.test.TestRemote</remote>
>> <ejb-class>com.apar.sslbridge.test.TestBean</ejb-class>
>> <session-type>Stateless</session-type>
>> <transaction-type>Bean</transaction-type>
>> <resource-ref>
>> <res-ref-name>jdbc/oraclePool</res-ref-name>
>> <res-type>javax.sql.DataSource</res-type>
>> <res-auth>Container</res-auth>
>> </resource-ref>
>> </session>
>> </enterprise-beans>
>> <assembly-descriptor>
>> <container-transaction>
>> <method>
>> <ejb-name>TestSession</ejb-name>
>> <method-intf>Remote</method-intf>
>> <method-name>*</method-name>
>> </method>
>> <trans-attribute>Required</trans-attribute>
>> </container-transaction>
>> </assembly-descriptor>
>></ejb-jar>
>>
>>
>>TestSession CODE:
>>
>>
>> public void doJob1() throws RemoteException
>> {
>> Statement st = null;
>> String query=null;
>> try{
>> con=getConnection();
>> st=con.createStatement();
>> query="insert into x values("+x+++")";
>> System.out.println(query);
>> int rec=st.executeUpdate(query);
>> }catch(SQLException sqle)
>> {
>> System.out.println("SQL Exception "+sqle);
>> throw new RemoteException("RemoteException*****SQLError");
>> } catch (Exception e) {
>> System.out.println("Exception "+e);
>> throw new RemoteException("RemoteException*****GenralError");
>> }
>>}
>>
>>
>> public void doJob2()throws RemoteException
>> {
>> Connection con=null;
>> Statement st = null;
>> String query=null;
>> try{
>> con=getConnection();
>> st=con.createStatement();
>> query="insert into y values("+x+++")";
>> System.out.println(query);
>> int rec=st.executeUpdate(query);
>> }catch(SQLException sqle)
>> {
>> System.out.println("SQL Exception "+sqle);
>> throw new RemoteException("RemoteException*****SQLError");
>> } catch (Exception e) {
>> System.out.println("Exception "+e);
>> throw new RemoteException("RemoteException*****GenralError");
>>}
>>}
>>private Connection getConnection(){
>>try {
>>Connection con = StaticParams.POOL_DATASOURCE.getConnection();
>>return con;
>> } catch(Exception e) {
>> System.out.println("TestBean.getConnection() Unable to get get pool
>>connection
>>" + e);
>> }
>>}
>>
>>
>>
>>
>>"Priscilla Fung" <[email protected]> wrote:
>>>
>>>It should work if you are using TxDataSource. Could you post your
>config.xml,
>>>deployment descriptors, code snippet for TestSession?
>>>
>>>Regards,
>>>
>>>Priscilla
>>>
>>>"Ranganath" <[email protected]> wrote:
>>>>
>>>>Hi,
>>>>
>>>> I am using UserTransaction in Stateless Session bean .
>>>> Transaction is not rolling back.
>>>>
>>>>The following code is writen in stateless session bean. In UserTransaction
>>>>i am
>>>>calling Two methods of another stateless session bean.
>>>> The problem is if doJob2() method fails, doJob1() method is rolling
>>>> back. These
>>>>two methods consist of SQL statement with different Connection Object
>>>>from TXDataSource.And
>>>>session bean(TestSession) is set to CMT, attribute as "Required".
>>>>
>>>> try{
>>>> Context ictx=new InitialContext();
>>>> TestHome home=(TestHome)ictx.lookup("TestSession");
>>>> utx = sessionCtx.getUserTransaction();
>>>> utx.begin();
>>>> TestRemote remote=home.create();
>>>> remote.doJob1();
>>>> remote.doJob2();
>>>> utx.commit();
>>>> }catch(Exception e)
>>>> {
>>>> try{
>>>> utx.rollback();
>>>> }catch(Exception ex)
>>>> {
>>>> System.out.println("unable to rollback"+ex);
>>>> }
>>>> }
>>>>if any SQL Exception as occured in doJob2(), its calling method utx.rollback()
>>>>in catch block. but SQL statements executed thru. doJob1() are not
>>rolling
>>>>back.
>>>>what might be the reason?
>>>>
>>>>thanks
>>>>Ranganath
>>>
>>
>
-
ORA-06519: active autonomous transaction detected and rolled back
I am getting this error. when i am doing insert from my package Any solution to reslove this issue
ORA-06519: active autonomous transaction detected and rolled back . thanks
I am doing select - insert...Also, if you have any exception handler sections in the code,
then you have to add a commit or rollback statement for
every exception that is handled. -
I have upgraded to PSE13 and want to unistall PSE9. When I try to do this all I get is an error message, "Error 1316. The specified account already exists". Then the uninstaller rolls back and I am left with a partially uninstalled version that is unusable. I tried to reinstall the software from the original PSE9 disk but all it tries to do is uninstall the version already on my computer, and this then does the same thing as noted above. How do I completely uninstall PSE9?
See here:
How do I remove older versions of Photoshop? -
Hi,
Needed your inputs on approach to implement a job using dbms_scheduler.
We have around 2000 schemas. Each schema has a package with 2 procedures.
The requirement is to create a single job in SYS that would loop through each schema and run the procedures at a specific time ( once a day) and send email notification on success or failure.
Job script:
BEGIN
dbms_scheduler.create_job( job_name=> 'LOAD_EACH_SCHEMA_AUDIT_DATA',
job_type=>'PLSQL_BLOCK',
job_action=>'BEGIN sys.p_loadaudit;
END;',
start_date=>systimestamp,
repeat_interval=>'FREQ=MINUTELY;INTERVAL=1',
number_of_arguments=>0,
enabled=> true,
comments=>'Job repeat interval is every 5 mins' );
END;
Note: for testing purpose i have set repeat interval to minutely.
Procedure job will be executing:
Procedure sys.p_loadaudit:
CREATE OR REPLACE
PROCEDURE p_loadaudit
AS
v_count NUMBER:= 0;
lv_error_message VARCHAR2(4000);
vstmt VARCHAR2(4000);
BEGIN
FOR i IN
( SELECT username FROM dba_users WHERE username LIKE 'ABCFIRM%'
LOOP
vstmt:= 'begin ' || i.username || '.pkg_audit_info.p_load_coa; end;';
EXECUTE immediate vstmt;
vstmt:= 'begin ' || i.username || '.pkg_audit_info.p_load_am; end;';
EXECUTE immediate vstmt;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
lv_error_message := 'Error in procedure p_loadaudit: ' || SQLCODE || ' -ERROR- ' || SUBSTR(
sqlerrm,1,300) || '*' || dbms_utility.format_error_backtrace;
raise_application_error(-20002,lv_error_message);
END p_loadaudit;
Example of one schema: SCHEMA_01
create or replace
PACKAGE pkg_audit_info
AS
type cursortype
IS
ref
CURSOR;
PROCEDURE p_load_COA;
PROCEDURE p_load_AM;
END pkg_audit_info;
create or replace
PACKAGE body pkg_audit_info
AS
PROCEDURE p_load_COA
AS
BEGIN
INSERT INTO TABLE1();
EXCEPTION
WHEN OTHERS THEN
lv_error_message := 'Error in procedure pkg_audit_info.p_load_COA: ' || SQLCODE
|| ' -ERROR- ' || SUBSTR(SQLERRM,1,300) || '*' || dbms_utility.format_error_backtrace;
RAISE_application_error(-20002,lv_error_message);
END p_load_COA;
PROCEDURE p_load_AM
AS
BEGIN
INSERT INTO TABLE2();
EXCEPTION
WHEN OTHERS THEN
lv_error_message := 'Error in procedure pkg_audit_info.p_load_AM: ' || SQLCODE ||
' -ERROR- ' || SUBSTR(SQLERRM,1,300) || '*' || dbms_utility.format_error_backtrace;
RAISE_application_error(-20002,lv_error_message);
END p_load_AM;
END pkg_audit_info;
Table1 and table1 exist in schema_01.
All 2000 schemas have same package.procedures.
Due to security reasons i have removed the actual code.
I was able to execute the job successfully. However, when a schema procedure (SCHEMA_01.pkg_audit_info.p_load_COA) throws an exception, the job fails and all transaction is rolled back.
Is there a way to loop through each schema and execute the related procedures. Even if exception happens, it should rollback only for that schema and continue the other schemas in the loop?
Please let me know if there is a better way to achieve this. Is the way i am handling exceptions in the job/procedure correct?
ThanksHi,
RAISE_APPLICATION_ERROR will cause the program to exit back to the caller, even if you place it in a block within the loop, so the RAISE or RAISE_APPLICATION_ERROR instruction should be placed in your "pkg_audit_info.p_load_AM" and "pkg_audit_info.p_load_coa" procedures. This way, you can use a block inside the loop and log the error.
FOR i IN
( SELECT username FROM dba_users WHERE username LIKE 'ABCFIRM%'
LOOP
BEGIN
vstmt:= 'begin ' || i.username || '.pkg_audit_info.p_load_coa; end;';
EXECUTE immediate vstmt;
vstmt:= 'begin ' || i.username || '.pkg_audit_info.p_load_am; end;';
EXECUTE immediate vstmt;
EXCEPTION
WHEN OTHERS THEN
--> Log the error in a custom log table otherwise you will not know what happened for that schema: don't forget the username
END;
END LOOP; -
Transaction Process not rolling back
Hi Experts,
I am testing the Transaction Process which uses a DB Adapter (which calls a procedure) to insert data into a table. There are 2 fileds in the table (employee id and employee name) and in this employee id is the primary key. In the same scope I invoke this DB Adapter PL twice and for the first invoke it went fine but for the second invoke it has thrown me a unique constraint exception (as again I am passing the same data). I am catching the exception with a catch all block which is working absolutely fine.
The problem is in the table I am getting the data entry for the first invoke which should have roll backed as i am using the *'transaction=participate'* property and respective changes have been done in bpel.xml for supporting the transaction.
There should be no entry in the table but yet I am getting it. Please help me.
Where could I have gone wrong?????
I am using BPEL-10.1.3.1 version.
Thanks in advance.
Cheers,
Ankit
Edited by: user11083689 on Apr 24, 2009 4:41 AMhi,
There are two mechanisms to force a rollback from a BPEL process.
Explicitly — throw a bpelx:rollback fault within your flow:
<throw name="Throw" faultName="bpelx:rollback"/>
Invoke a partner link that marks the JTA transaction for rollback only.
For example, in Oracle SOA Suite for 10.1.3.1.0, if Oracle BPEL Process Manager invokes an Oracle Enterprise Service Bus (ESB) flow that in turn fails to call a Web service endpoint, the JTA transaction is marked for rollback. Since the Oracle ESB flow enlists its local transaction in the JTA transaction, a rollback on the JTA transaction impacts Oracle BPEL Process Manager's ability to dehydrate (as the JTA transaction is used by Oracle BPEL Process Manager for persistence).
regards
Rajesh -
Once Again: Transaction is not rolled back...
Hi all,
I'm almost at the end of my project with Toplink. but I have to solve this transaction rollback problem. Here is my previous message. any comment is more than welcome.
The problem is this, I pass 2 objects to Toplink to update in database using activeUnitOfWork.shallowMergeClone() method.
one of the updates fails then I expect everything to be rolled back within the same unitofwork. but NOT. the other object is quite well updated in database even though they are merged in the same unit of work... please HELP...
here is the log :
UnitOfWork(31228)--JTS#beforeCompletion()
UnitOfWork(31228)--#executeQuery(WriteObjectQuery(com.vnu.publitec.axis.persistence.Parameters@7a0b))
UnitOfWork(31228)--Connection(31249)--UPDATE PARAMETERS SET PARAM_VALUE = '26' WHERE (PARAM_NAME = 'TEST_PARAMETER_2')
UnitOfWork(31228)--#reconnecting to external connection pool
UnitOfWork(31228)--#executeQuery(WriteObjectQuery(com.vnu.publitec.axis.persistence.Parameters@7a06))
UnitOfWork(31228)--Connection(31249)--UPDATE PARAMETERS SET PARAM_MAX_SIZE = 666666, PARAM_COMMENTS = 'updated by new axis...', PARAM_VALUE = '18' WHERE (PARAM_NAME = 'TEST_PARAMETER_1')
UnitOfWork(31228)--EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException
EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-01438: value larger than specified precision allows for this column
INTERNAL EXCEPTION: java.sql.SQLException: ORA-01438: value larger than specified precision allows for this column
...... //some more message
UnitOfWork(31228)--JTS#afterCompletion()
UnitOfWork(31228)--release unit of work
ClientSession(31229)--client released
environment information is :
J2EE Server is Oracle9iAS (9.0.3.0.0) Containers for J2EE
and following is a piece of sessions.xml file related to external transaction controller settings :
<session-type>
<server-session/>
</session-type>
<login>
<datasource>java:comp/env/jdbc/xxx</datasource>
<uses-native-sql>true</uses-native-sql>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
<uses-external-connection-pool>true</uses-external-connection-pool>
</login>
<external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
thanks
Erdem.Hi James,
As Erdem is not available, I am now taking care of the issue. The datasource name in session.xml refers to the one defined in OC4J data-sources.xml "ejb-location" attribute of "data-source" element. Below, I attach the relevant sections of both files
session.xml
<session>
<name>Axis_session</name>
<project-xml>AxisCDM.xml</project-xml>
<session-type>
<server-session/>
</session-type>
<login>
<datasource>java:comp/env/jdbc/AXIS_323DS</datasource>
<uses-native-sql>true</uses-native-sql>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
<uses-external-connection-pool>true</uses-external-connection-pool>
</login>
<external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
data-sources.xml:
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="AXIS_323DS"
location="jdbc/AXIS_323CoreDS"
xa-location="jdbc/xa/AXIS_323XADS"
ejb-location="jdbc/AXIS_323DS"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="XXX"
password="XXX"
url="jdbc:oracle:oci8:@ddb"
inactivity-timeout="30"
connection-retry-interval="1"
/>
On the client we get the following exception:
com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: Error in transaction: EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException
EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-01438: value larger than specified precision allows for this column
On the server, we have implemented SessionSynchronization to monitor the transaction. afterCompletion method gets a boolean value "true" indicating that the transaction was comitted.
Any database operation that was successful before the erroneous case was saved in DB.
Thanks,
Melih -
Transaction doesn't roll back to Oracle
Hello, I would like to ask does webloogic support transaction controlled by client
which is out of container? My case is that i use UserTransaction in the client
application(not within bean). Bean methods (CMP) are invoked between the UserTransaction.begin()
and UserTransaction.rollback(). However, row are inserted into database and the
rollback fail at the end.
Any ideas?
Thanks
Joseph Weinstein <[email protected]> wrote:
>
>
>Leo Choi wrote:
>
>> Hello, I would like to ask does webloogic support transaction controlled
>by client
>> which is out of container? My case is that i use UserTransaction in
>the client
>> application(not within bean). Bean methods (CMP) are invoked between
>the UserTransaction.begin()
>> and UserTransaction.rollback(). However, row are inserted into database
>and the
>> rollback fail at the end.
>>
>> Any ideas?
>
>I assume you get the UserTransaction from Weblogic. How are the bean's
>transactional
>behavior specified? TX-SUPPORTS, TX-REQUIRES, etc? What version of weblogic
>are you running? To answer your question in the general, if the beans
>are involved in the
>transaction, then all DBMS updates they do should roll back if you roll
>back the UserTransaction.
>If, however, the beans are not part of the tx, such as if they are marked
>as TX-REQUIRES-NEW,
>then each invoke of the bean will start it's own tx during the invoke,
>and commit it separately
>at each method, so any later rollback of the bigger tx won't involve
>any of the little
>already-committed
>EJB tx's...
>Joe
>
>>
>>
>> Thanks
>
Thanks for you reply. I am new to transaction.
The version i am using is 7.0. I get the UserTransaction by ctx.lookup("UserTransaciton......)
where ctx is the InitialContext.
You are right, i found that the transaction is committed at each method.
If i call setRollBackOnly() before calling the bean method, the transaction
cannot committed.
But it is meaningless to me since the transaction should be able to roll
back at any points before the UserTansaction.commit();
TX-SUPPORTS, TX_REQUIRES....are you talking about the deployment descriptor?
I have check the deployment descriptor, the transaction attr is Required.
The rollback() method doesnt work. Are there any things missing?
Thanks
-
Bean-managed stateless session bean can't roll back using JTA
I use weblogic6.1sp2 + jdk131
a stateless session bean must do 2 things:
insert a record to A table and delete another record in A table
this bean has the same structure as the example in
j2eetutorial/examples/src/ejb/teller
I use TxDataSource in weblogic
if delete fail, the roll back is run,but in database,
the insert record is STILL in A table.
any idea?make sure that your deployment descriptor says "transaction required".
Also, If the insert and delete are two different methods, the client must call these two methods in the same transaction scope. -
How many of the transactions woill be Roll backed?
Hi friends,
Could you please clarify That How many of the transactions will be rollbacked when we say ROLLBACK....?
(For e.g., As a first transaction i used delete command to delete one row from a table of 10 rows....As a second transaction i used update command two times to update two records in the same table....Now i created one table ...after that i said rollback....So how many of the transactions will be rollbacked?)I'm sure blushadow has heard of all of those, but what does it have to do with the original question?
SQL> CREATE TABLE t AS
2 SELECT rownum id, TO_CHAR(TO_DATE(rownum, 'J'), 'Jsp') descr
3 FROM all_objects WHERE rownum < 10;
Table created.
SQL> SELECT * FROM t;
ID DESCR
1 One
2 Two
3 Three
4 Four
5 Five
6 Six
7 Seven
8 Eight
9 Nine
SQL> DELETE FROM t WHERE id = 1;
1 row deleted.
SQL> SAVEPOINT a;
Savepoint created.
SQL> UPDATE t SET descr = 'Deux'
2 WHERE id = 2;
1 row updated.
SQL> SAVEPOINT b;
Savepoint created.
SQL> UPDATE t SET descr = 'Trois'
2 WHERE id = 3;
1 row updated.
SQL> SELECT * FROM t;
ID DESCR
2 Deux
3 Trois
4 Four
5 Five
6 Six
7 Seven
8 Eight
9 NineI agree that at this point, I can rollback to any point in these three statements, however, as soon as I do:
SQL> CREATE TABLE t1 (id NUMBER);
Table created.then the savepoints are gone
SQL> ROLLBACK TO b;
ROLLBACK TO b
ERROR at line 1:
ORA-01086: savepoint 'B' never establishedNow, the documentation says "If you use a SET TRANSACTION statement, then it must be the first statement in your transaction.", and the very first DELETE starts a transaction. and the fact that:
SQL> SET TRANSACTION AUTONOMOUS;
SET TRANSACTION AUTONOMOUS
ERROR at line 1:
ORA-00900: invalid SQL statementis invalid, even if you could use SET TRANSACTION within an already started transaction. I suppose you could do:
SQL> DROP TABLE t1;
Table dropped.
SQL> TRUNCATE TABLE t;
Table truncated.
SQL> INSERT INTO T
2 SELECT rownum id, TO_CHAR(TO_DATE(rownum, 'J'), 'Jsp') descr
3 FROM all_objects WHERE rownum < 10;
9 rows created.
SQL> COMMIT;
Commit complete.
SQL> DELETE FROM t WHERE id = 1;
1 row deleted.
SQL> SAVEPOINT a;
Savepoint created.
SQL> UPDATE t SET descr = 'Deux'
2 WHERE id = 2;
1 row updated.
SQL> SAVEPOINT b;
Savepoint created.
SQL> UPDATE t SET descr = 'Trois'
2 WHERE id = 3;
1 row updated.
SQL> DECLARE
2 PRAGMA AUTONOMOUS_TRANSACTION;
3 BEGIN
4 EXECUTE IMMEDIATE 'CREATE TABLE t1 (id NUMBER)';
5 END;
6 /
PL/SQL procedure successfully completed.
SQL> ROLLBACK to b;
Rollback complete.but it seems like a lot of effort to get around something that you shouldn't be doing in the first place.
John -
Multiple Transaction with Fully Rolled Back
Hi there,
I've the scenario for a project that require multiple transaction as a subsequent process. I'll have one RFC Function Module that wrap multiple BAPI inside there. This RFC will be publish as a webservice and will be consumed by .NET application.
The problem that I've, the subsequent process will depend each other. For the example : Create SO, Purch Requisition, and with Reference to PR, I need to create the PO. So I need to commit the transaction for Sales Order creation before I can't continue to create the purchase order.
If there is a problem during the creation of PO, the Sales Order already committed to the database and I can't roll it back.
Any suggest, how I can handle this situation with concept of Complete the whole transaction and not at all if there is an error for one of the transaction.
Thanks in advance for any help.
Cheers,
DannyHi Danny,
Unfortunately this is the only option for you because you cannot rollback after you commit to the database. The other option would be to trigger Check BAPIs or BAPIs with test mode = 'X'....but that will be a problem for e.g. if you want to create a PO with reference to a PR created in the earlier step. If you can omit the part of creating with reference, then I think this is possible by first triggering BAPIs in test mode for all the documents that have to be created - if the whole chain is successful then you trigger BAPIs in update mode to post the docs (Commit) or else exit the process. Hope it made sense.
Cheers,
Sougata. -
Transaction is not rolling back
I have statefull session CMT bean and I have a method
public void meth1() {
try {
dao1.method1(connection);
dao2.method2(connection);
} catch (SQLException ex) {
sessioncontext.setRollbackOnly();
throw (application exception);
If dao2.method2 raises sqlexception then whatever happend in dao1.method1 is committed. I have "Required" as transaction attribute for this session method.
Also I cannot raise system exception as this removes the session bean instance. We are using j2ee 1.2.
How to rollback for application errors.
Thanks in advanceI've never used oracle, so I can't say what your setup should be, however...
databases can have transactions and the syntax is different between databases, e.g.
start {start the transaction}
update table X .....
rollback {rollback the transaction}
should not update the database
but if table X does not support transactions, you can't do this.
I had this problem with mysql, where everything worked fine until I had an exception or called setRollbackOnly. Some stuff would rollback (ovbiously cached in the app server), but other stuff wouldn't.
I configured the tables in mysql to support transactions and it all worked. -
Hello all,
I'm using the below code to send the notication using plsql package. It works fine and sends notification if i don't use '#FROM_ROLE' and 'SENDER' attributetext in the code. If i use them, i get the error message. Please advice
L_MESSAGE_TYPE := 'WFMAIL';
L_MESSAGE_NAME := 'OPEN_MAIL_FYI';
L_NID := WF_NOTIFICATION.SEND(UPPER(P_USER_NAME),
L_MESSAGE_TYPE,
L_MESSAGE_NAME);
WF_NOTIFICATION.SETATTRTEXT(L_NID, 'SUBJECT', P_SUBJECT);
WF_NOTIFICATION.SETATTRTEXT(L_NID, 'BODY', P_TEXT_BODY);
WF_NOTIFICATION.SETATTRTEXT(L_NID, '#FROM_ROLE', 'USERNAME1');
WF_NOTIFICATION.SETATTRTEXT(L_NID, 'SENDER', 'USERNAME1');
WF_NOTIFICATION.DENORMALIZE_NOTIFICATION(L_NID);
Thanks
KKHi KK,
What error you are getting when you set the attributes '#FROM_ROLE' and 'SENDER'?
when you set '#FROM_ROLE' then Wf_Notification.Denormalize_Notification(nid) API will be called. If the attribute is 'sender' then event 'oracle.apps.wf.notification.setattrtext wll be rasied.
Maybe you are looking for
-
Hi, When I am processing vendor payment through Automatic payment transaction (F110), system is calculating vendor payment net of cash discount though the payment is overdue. For e.g., due date is 10th July 09, but I am processing payment 15th July,
-
[JS CS3/4] MAC OS X Ignore resizeable & maximizeButton set to false
Hi, I set both resizeable and maximiseButton parameters of my scriptUI window to false. On Mac OS X, these parameters seem to be overriden bu the system while on Windows XP, it's OK. Is that a know issue ? Loic
-
I just bought my g4-2149se from wal-mart and It wont eject my cd with the botton, nor when i go to the drive and select eject. It gives me an error message. Any help? or should I just take it back to wal-mart?
-
I have been using my mw600 headset with my iPhone 4 since the day i bought it and it has been working perfectly on the device n improved a lot after iOS5 upgrade as it started showing the song titles on the headset even..i recently bought an iPhone 4
-
Adobe acrobat 11 braucht lange fürs einfügen einer kopie
Hallo zusammen, habe den Versionswechsel zu Adobe Acrobat 11.0.06 von 10 vorgenommen und das Kopieren - Einfügen dauert sehr lange. Problembeschreibung: 1. Adobe Acrobat 11 gestartet. 2. PDF in der Anzeige aus der eine Seite kopiert wird 3. Ein ande