Query for 2 PHASE COMMIT

Hi,
I need to understand concept of 2 phase commit.plz tell me..
INSERT INTO EMP_BKP(EMPNO) VALUES(777);
CREATE TABLE empbkp2 AS SELECT * FROM emp;
ROLLBACK;
SELECT * FROM EMP_BKP;
o/p:
empno
777
due to create stmnt it was autocommit so i got result..
INSERT INTO EMP_BKP(EMPNO) VALUES(777);
CREATE TABLE HJHJH AS SELECT * FROM JKJL; -- table JKJL doesn't exists
ROLLBACK;
SELECT * FROM EMP_BKP;
o/p:
empno
777
got error in create stmnt then too got o/p..
how it worked as create command failed.?

PC wrote:
Hi,
I need to understand concept of 2 phase commit.plz tell me..
INSERT INTO EMP_BKP(EMPNO) VALUES(777);
CREATE TABLE empbkp2 AS SELECT * FROM emp;
ROLLBACK;
SELECT * FROM EMP_BKP;
o/p:
empno
777
due to create stmnt it was autocommit so i got result..
INSERT INTO EMP_BKP(EMPNO) VALUES(777);
CREATE TABLE HJHJH AS SELECT * FROM JKJL; -- table JKJL doesn't exists
ROLLBACK;
SELECT * FROM EMP_BKP;
o/p:
empno
777
got error in create stmnt then too got o/p..
how it worked as create command failed.?CREATE TABLE is DDL & every DDL does COMMIT before it starts & COMMIT after it ends.
You can only ROLLBACK DML & not DDL

Similar Messages

  • How to handle comma separated values in OLE DB Source query for a parameter variable from XML file in SSIS

    Hi,
    I am using OLE DB Source to fetch the records with Data Access Mode as SQL COMMAND which is using the below query with a parameter,
    SELECT CON.Title,CON.FirstName,EMP.MaritalStatus,EMP.Gender,EMP.Title AS Designation, EMP.HireDate, EMP.BirthDate,CON.EmailAddress, CON.Phone
    from HumanResources.Employee EMP INNER JOIN Person.Contact CON ON EMP.ContactID=CON.ContactID WHERE EMP.Title in (?) 
    In this query for the parameter I am passing the value from a variable and which is configured (XML Configuration). While passing value
    Buyer it works correctly. But while passing values Accountant,Buyer
    it is not working as expected.
    How to handle while passing such multiple values Or is it possible to pass such values or not in SSIS 2012 ?
    Kindly help me to find a solution.
    NOTE: I placed the whole query in a variable as a expression as below it is working fine.
    "select CON.Title,CON.FirstName,EMP.MaritalStatus,EMP.Gender,EMP.Title AS Designation,EMP.HireDate,EMP.BirthDate,CON.EmailAddress,CON.Phone from HumanResources.Employee EMP
    INNER JOIN Person.Contact CON ON EMP.ContactID=CON.ContactID WHERE EMP.Title in ('" + REPLACE(@[User::temp],",","','")  +"')"
    Any other solution is there ? without placing the query in a variable. May be a variable can have some limitations for no. of characters stored not sure just a thought.
    Sridhar

    Putting the whole thing into a variable is certainly a valid solution.  The other involves putting the comma delimited list into a table valued variable.
    http://gallery.technet.microsoft.com/scriptcenter/T-SQL-Script-to-Split-a-308206f3
    For an odd ball approach: 
    http://www.sqlmovers.com/shredding_multiline_column_using_xml/ .
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • ADF Service Interface: two-phase commit issue for multiple data sources

    In FusionApps, For a service interface we had to use two DataSource resources (in the ejb-jar.xml),
    one is ApplicationServiceDBDS for SI and the other one is ApplicationDBDS(I don’t know the exact reason why this is needed, but when running the webservice, Framework was throwing an error asking for this) After adding these two, now(while running the webservice) we’re caught up with an error saying that unable to participate in two phase commit. I think this is because we added two dataSources, if we just use one dataSource everything is working fine.
    Error message from app server:
    "JDBC driver does not support XA, hence cannot be a participant in two-phase commit. To force this participation, set the GlobalTransactionsProtocol attribute to LoggingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source=ApplicationDB"
    we have made the changes to ApplicationDB as said in the error message, but then the server is failing to start because of this.

    Hi,
    this is what the doc says - though not about two phase commit but transaction sharing:
    "At runtime, the calling client and the ADF service may or may not participate in the same transaction, depending on the protocol used to invoke the service (either SOAP or RMI). Only the RMI protocol and a Java Transaction API (JTA) managed transaction support the option to call the service in the same transaction as the calling client."
    When your application accesses a remote ADF Business Components service, each remote call is stateless, and the remote service will not participate in the same transaction as the business component that uses a service-enabled application module's service interface.
    In the majority of the cases, calls to remote services will be informational in nature and will not make changes to remote objects. However, if you must use a remote service to make changes, then keep these points in mind:
    An exception thrown by the remote service will cause the local transaction to fail.
    If you successfully call a remote service that results in modifying data, and then subsequently your local transaction fails for any reason, then it is the responsibility of your error handling code to perform a compensating transaction against the remote service to "undo" the previous change made."
    http://docs.oracle.com/cd/E23943_01/web.1111/b31974/bcextservices.htm
    Frank

  • How to enable 2 phase commit in oracle11g(for distributed oracle databases)

    Hi All,
    We have three oracle servers(11g) and we need to update the data from one server to remaining servers. Want to know, is "two phase commit" automaticly enabled/installed in 11g or we need to enable it. If we need to enable it then what are the all steps required for the same.
    Thanks & Regards
    Ravi

    It is always very nice to see people think they are so unique their question has not already been answered in the documentation.
    Yes, two phase commit is enabled.
    No, depending on what you want, automatically updating records from one server to other servers is likely a very bad idea, as Oracle has documented facilities for that.
    You have amongst others
    - Materialized views
    - Oracle Streams
    Those solutions definitely scale much better as your approach, as they are asynchronous. In your approach the master server will slow down as a result of updating slaves.
    In distributed databases 'push' approaches are to be avoided and 'pull' approaches to be preferred. Which is exactly what materialized views and Streams do.
    Sybrand Bakker
    Senior Oracle DBA

  • 2 phase commit for entity bean

    Hi all,
    Does the 2-phase commit capability in WL6.X applies to entity bean?
    Thanks,
    Rick

    Two phase commit is the mechanism that allows transactions to the managed
    across different servers and databases.
    yes, definitely I does apply for entity beans
    "Rick Lee" <[email protected]> wrote in message
    news:[email protected]..
    >
    Hi all,
    Does the 2-phase commit capability in WL6.X applies to entity bean?
    Thanks,
    Rick

  • Whats 2-phase commit for

    hi guys
    i am curious, why JTA invent the 2-phase commit?
    whats it stand for? how we use it.
    thanks alot

    http://www.webopedia.com/TERM/T/two_phase_commit.html
    http://www.sei.cmu.edu/str/descriptions/dtpc.html
    or just google it.

  • 2 Phase Commit for ESB based Appliation

    If I wrote an application that needed two phase commit and I used Oracle ESB as the mechanism to link two different parts of the application together, would I have that capability?

    ESB supports global transactions such that if any XA endpoint fails, the others are rolled back. See the transaction/exception handling lesson on otn.oracle.com/goto/esb for details of how it works.

  • SAP Transaction in Two phase Commit ?

    Hi all,
    When we make a connection to SAP system from .NET application using .NET connector, we can make calls to transactional BAPI/RFC’s. But is there any way in which we can make SAP transaction take part in MS DTC (Microsoft Distributed Transaction Coordinator) transactions?
    We want to implement a two phase commit and hence this question. Please let us know if you are aware of any mechanism using which we can implement a two phase commit.
    The call scenario is described below:
    TransactionScope
    1.     SQL_StoredProc1();
    2.     SQL_StoresProc2();
         10.           SAP_TransactionBAPI();
         11.          SQLStoredProcn();
          12.           SQLTransaction_Commit();
          13.      SAPTransaction_Commit();
    Exception ()
    SQLTransaction_Rollback();
    SAPTransaction_Rollback();
    In the above case all the statements have to be executed successfully or they have to be rolled back. Let’s think of the situation where all the statements up to line 13 have been executed successfully, but there was a failure during the commit of SAP, and then we have to rollback the SQL transaction also which is already committed.
    This situation can be handled if and only if SAP transaction manager follows XA transaction protocol and it can include itself in MSDTC. So that every transaction manager votes for the commit (it can be called half commit) if the transaction is successful otherwise all the transactions should be rolled back.
    Can anybody tell me the way to include SAP transaction manager in MSDTC if it at all possible?

    Hi Saket,
    I did  not understand much of your query but just wanted to know how are you making a connection to the backend here?
    If using DataSources and if the datasource is configured directly in the EP server (using Visual Administrator), you have an option of the required 2-way commit.
    The datasource takes care of it directly. Apart from this, the datasource will also take cre of the connection pooling.
    Hope this helps.
    Awaiting Reply.
    Warm Regards,
    Ritu

  • MDB (2-phase commit) behavior during abnormal JMS termination

    Hello to everyone!
    I plan to test the following scenario tomorrow (sort of a bug replication in our system).
    Anyway, wanted to know in advance the expected behavior (just in case one of you already know
    or have an experience related to this test). Thank you in advance.
    Scenario:
    I want to test/know the behavior of a 2-phase commit (2PC) MDB when JMS server abnormally exits
    (say the process was killed).
    Test flow:
    start app server --> deploy 2pc-mdb --> send dummy data --> kill jms process --> restart jms process
    1. will the connection be closed properly?
    2. when jms server restarts, will the value of active consumer(count) doubled?
    note: i think after mdb deployment, corresponding destination consumer count is 1.
    the problem that occurred in our system was that the consumer count doubled after server restarted.
    it seem like the previous connection was not closed when the jms server abnormally terminated.
    any inputs will be greatly appreciated.
    thanks and best regards.

    You have to use TxDataSource for container managed tx or if you are using JTA (in
    addition to ofcourse doing 2PC).
    S
    "Dale Olzer" <[email protected]> wrote:
    >
    Using weblogic 6.1 SP 4
    I have a simple container managed Message Driven Bean. Using a destination
    type
    javax.jms.Queue.
    When the onMessage method finishes the Message is still Pending on the
    queue.
    see the ejb-jar.xml below
    <ejb-jar>
    <enterprise-beans>
    <message-driven>
    <display-name>IvrMessageBean</display-name>
    <ejb-name>IvrMsgBean</ejb-name>
    <ejb-class>com.edocs.ps.ivr.IvrMsgBean</ejb-class>
    <transaction-type>Container</transaction-type>
    <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
    <message-driven-destination>
    <destination-type>javax.jms.Queue</destination-type>
    </message-driven-destination>
    </message-driven>
    </enterprise-beans>
    </ejb-jar>
    I noticed when I set a JDBC TX DataSource to 2 Phase Commit, the JMS
    transaction
    started commitig and nothing was left pending in the Queue.
    Does 2PC have to be set in a DataSource for Container Managed MDB's to
    work?

  • Problem writing a sql query for a select list based on a static LOV

    Hi,
    I have the following table...
    VALIDATIONS
    ID          Number     (PK)
    APP_ID          Number     
    REQUESTED     Date          
    APPROVED     Date          
    VALID_TIL     Date
    DEPT_ID          Number     (FK)
    I have a search form with the following field item variables...
    P11_DEPT_ID (select list based on dynamic LOV from depts table)
    P11_VALID (select list based on static Yes/No LOV)
    A report on the columns of the Validations table is shown based on the values in the search form. So far, my sql query for the report is...
    SELECT v.APP_ID,
    v.REQUESTED,
    v.APPROVED,
    v.VALID_TIL,
    d.DEPT
    FROM DEPTS d, VALIDATIONS v
    WHERE d.DEPT_ID = v.DEPT_ID(+)
    AND (d.DEPT_ID = :P11_DEPT_ID OR :P11_DEPT_ID = -1)
    This query works so far. My problem is that I don't know how to do a search based on the P11_VALID item - if 'yes' is selected, then the VALID_TIL date is still valid. If 'no' is selected then the VALID_TIL date has passed.
    Can anyone help me to extend my query to include this situation?
    Thanks.

    Hello !
    Let's have a look at my example:create table test
    id        number
    ,valid_til date
    insert into test values( 1, sysdate-3 );
    insert into test values( 2, sysdate-2 );
    insert into test values( 3, sysdate-1 );
    insert into test values( 4, sysdate );
    insert into test values( 5, sysdate+1 );
    insert into test values( 6, sysdate+2 );
    commit;
    select * from test;
    def til=yes
    select *
      from test
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);
    def til=no
    select *                                                                               
      from test                                                                            
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);  
    drop table test;  It's working fine, I've tested it.
    The above changes to my first idea I did because of time portion of the DATE datatype in Oracle and therefore the wrong result for today.
    For understandings:
    1.) TRUNC removes the time part of DATE
    2.) The difference of to date-values is the number of days between.
    3.) SIGN is the mathematical function and gives -1,0 or +1 according to an negative, zero or positiv argument.
    4.) DECODE is like an IF.
    Inspect your LOV for the returning values. According to my example they shoul be 'yes' and 'no'. If your values are different, you may have to modify the DECODE.
    Good luck,
    Heinz

  • Two phase commit and bean managed transactions

    To all the Transaction GURUS!
              Hi guys (-and gals).
              I've been doing J2EE for quite a while, but today was my first at
              XA-Transactions and Bean Managed Transactions.
              Why am I doing this?
              ====================
              Well I have to be able to controll the transactionalbehaviour of my
              bean
              during runtime, since some bean calls would cause a transactional
              overflow due to the stress they would cause to the system, whereas
              smaller bean calls need to run in one transaction.
              -> Therefore I need Bean Managed Transactions
              Since the bean does a call on two Database Connections it has to use a
              XA-Transaction.
              -> Therefore I need XA-Transactions.
              Abstract
              ========
              - I just can't get a User TransAction into the right Status it stays
              in 'STATUS_NO_TRANSACTION' all the time
              - Therefore the SQL Commands can be comitted 'java.sql.SQLException:
              Does not support SQL execution with no global transaction'
              - Therefore I can't do a rollback 'java.lang.IllegalStateException:
              Transaction does not exist'
              - Therefore I wrote this mail.
              I don't want to be a smart-"ass" writing such a detailed and indepth
              mail. I just would like to show that I tried, and would like to have
              some replies from you guys.
              Below are my configurations, code and logfiles.
              Thanx for taking your time and hope that the other people may learn
              something as well.
              cu
              Stefan
              Scenario
              ========
              used Software
              Bea Weblogic (WL) 6.0 SPx (not real sure which SP i have)
              Oracle 8.1.6 using the API-Version 8
              I configured the system as follows:
              (ofcourse I 'xxx'ed out all of the confidential data, sorry guys;-))
              excerpt from:
              config.xml
              <JDBCConnectionPool CapacityIncrement="5"
              DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="2"
              LoginDelaySeconds="1" MaxCapacity="5" Name="oraclePool"
              Properties="user=xxx;password=xxx;dll=ocijdbc8;protocol=thin"
              RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
              TestTableName="languages" URL="jdbc:oracle:thin:@xxx:1521:xxx "/>
              <!-- Since this is our Main Datasource I would not like to use a XA
              Transaction due to performance Issues
              and the TxDataSource:
              -->
              <JDBCTxDataSource EnableTwoPhaseCommit="true"
              JNDIName="finstral.datasource.fbs" Name="finstral Content Datasource"
              PoolName="oraclePool" Targets="fbsserver"/>
              <!-- no comment required -I hope.
              Next comes the "special" Pool
              -->
              <JDBCConnectionPool CapacityIncrement="5"
              DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
              LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
              Properties="user=xxx;password=xxx;server=xxx.xxx.xxx"
              RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
              TestTableName="Users" SupportsLocalTransaction="true"/>
              <!-- Well since there can only be one none XARessourceManager involved
              in a 2PC
              (keyword: Two Phase Commit) I will have to use a XACapable Driver for
              the other
              Datasource. Due to all the bugs in the oracle.xxx driver. I'll be
              using the jdriver for oci.
              I activated 'SupportsLocalTransaction' hoping it would solve my
              problem - without effect. I just left in there now, since it made
              sense me. Not?
              Again the TxDataSource:
              -->
              <JDBCTxDataSource EnableTwoPhaseCommit="true"
              JNDIName="finstral.datasource.fbssecurity" Name="finstral Security
              Datasource" PoolName="oracleSecurityPool" Targets="fbsserver"/>
              <!-- The System starts right up and can locate the test tables and
              everything. So I think all of this stuff is working here -->
              ejb-jar.xml
              <ejb-jar>
                   <enterprise-beans>
                        <session>
                             <ejb-name>TPCTestBean</ejb-name>
              <home>de.sitewaerts.futuna.common.test.tpcbean.TPCHome</home>
              <remote>de.sitewaerts.futuna.common.test.tpcbean.TPC</remote>
              <ejb-class>de.sitewaerts.futuna.common.test.tpcbean.TPCBean</ejb-class>
                             <session-type>Stateless</session-type>
                             <transaction-type>Bean</transaction-type>
                        </session>
                   </enterprise-beans>
                   <assembly-descriptor/>
              </ejb-jar>
              <!-- Originally I had the assembly-descriptor full of transaction
              requirements. I thought since
              the bean is handling all of the transaction stuff itself, it might get
              confused by the 'container-transaction'
              properties, and deleted them. Do I need them anyway?-->
              weblogic-ejb-jar.xml
              <weblogic-ejb-jar>
                   <weblogic-enterprise-bean>
                        <ejb-name>TPCTestBean</ejb-name>
                        <stateless-session-descriptor/>
                        <jndi-name>finstral/ejb/test_tpc</jndi-name>
                   </weblogic-enterprise-bean>
              </weblogic-ejb-jar>
              <!-- Nothing I have to explain here -->
              BeanCode (from the implementingBeanClass:
              'de.sitewaerts.futuna.common.test.tpcbean.TPCBean')
              public void setupTables() throws RemoteException
              UserTransaction tx = getTransaction();
              //getTransaction calls: 'tx = sCtx.getUserTransaction()' and does
              some errorhandling
              log.info("Die Transaktion vor den Connections: "+tx.toString());
              //Sorry bout the German. You should get the Message though.
              log.info("Der Transaktionsstatus vor den Connections:
              "+transactionStatus(tx));
              Connection conSecurity = getConnection(DATASOURCE_SECURITY, tx);
              //gets a Connection via a DataSourceName from the JNDI tree
              Connection conContent = getConnection(DATASOURCE_CONTENT, tx);
              log.info("Die frische Connection conSecurity: "+conSecurity);
              log.info("Die frische Connection conContent: "+conContent);
              tearDownTable(conSecurity);
              //Does nothing special
              tearDownTable(conContent);
              log.info("Die Transaktion nach dem Teardown: "+tx.toString());
              log.info("Der Transaktionsstatus nach dem Teardown:
              "+transactionStatus(tx));
              Statement stmt = null;
              try
              stmt = conSecurity.createStatement();
              //Well its getting interesting now.....
              log.info("Die Transaktion vor dem createtable: "+tx.toString());
              log.info("Der Transaktionsstatus vor dem createtable:
              "+transactionStatus(tx));
              log.info("Die Connection conSecurity vor dem createtable:
              "+conSecurity);
              log.info("Die Connection conContent vor dem createtable:
              "+conContent);
              stmt.executeUpdate(CREATE_TABLE);
              //above is the row 91 -> throws: 'java.sql.SQLException: Does
              not support SQL execution with no global transaction'
              stmt.close();
              stmt = conContent.createStatement();
              stmt.executeUpdate(CREATE_TABLE);
              stmt.close();
              commitTransaction(tx);
              catch (SQLException sqle)
              log.error("Konnte kein table init machen", sqle);
              rollbackTransaction(tx);
              //The Code for this method is below
              throw new EJBException(sqle);
              finally
              closeConnection(conSecurity);
              closeConnection(conContent);
              protected void rollbackTransaction(UserTransaction tx)
              log.info("Der Transaktionsstatus vor dem Rollback:
              "+transactionStatus(tx));
              log.info("Die Transaktion vor dem Rollback: "+tx.toString());
              try
              tx.rollback();
              //above is row 200 -> throws: 'java.lang.IllegalStateException:
              Transaction does not exist'
              log.info("Der Transaktionsstatus nach dem Rollback:
              "+transactionStatus(tx));
              log.info("Die Transaktion nach dem Rollback: "+tx.toString());
              catch (Exception e)
              log.error("Konnte die Transaktion nicht backrollen.", e);
              throw new EJBException(e);
              Log Excerpt
              ===========
              INFO setupTables() (66) - Die Transaktion vor den Connections:
              [email protected]
              INFO setupTables() (67) - Der Transaktionsstatus vor den Connections:
              STATUS_NO_TRANSACTION
              INFO setupTables() (72) - Die frische Connection conSecurity:
              weblogic.jdbc.rmi.SerialConnection@7c6daa
              INFO setupTables() (73) - Die frische Connection conContent:
              weblogic.jdbc.rmi.SerialConnection@3b425
              INFO setupTables() (78) - Die Transaktion nach dem Teardown:
              [email protected]
              INFO setupTables() (79) - Der Transaktionsstatus nach dem Teardown:
              STATUS_NO_TRANSACTION
              INFO setupTables() (86) - Die Transaktion vor dem createtable:
              [email protected]
              INFO setupTables() (87) - Der Transaktionsstatus vor dem createtable:
              STATUS_NO_TRANSACTION
              INFO setupTables() (88) - Die Connection conSecurity vor dem
              createtable: weblogic.jdbc.rmi.SerialConnection@7c6daa
              INFO setupTables() (89) - Die Connection conContent vor dem
              createtable: weblogic.jdbc.rmi.SerialConnection@3b425
              ERROR setupTables() (101) - Konnte kein table init machen
              java.sql.SQLException: Does not support SQL execution with no global
              transaction
                   at
              weblogic.jdbc.oci.xa.XAConnection.beforeExecute(XAConnection.java:137)
                   at
              weblogic.jdbc.oci.xa.Statement.executeUpdate(Statement.java:112)
                   at weblogic.jdbc.jta.Statement.executeUpdate(Statement.java:185)
                   at
              weblogic.jdbc.rmi.internal.StatementImpl.executeUpdate(StatementImpl.jav
              a:42)
                   at
              weblogic.jdbc.rmi.SerialStatement.executeUpdate(SerialStatement.java:54)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.jav
              a:91)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBean
              Impl.java:130)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCBe
              anEOImpl.java:64)
                   at
              de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseCo
              mmitUnitTest.java:51)
                   at
              org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTes
              tCase.java:297)
                   at
              org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servle
              tTestCaller.java:148)
                   at
              org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCal
              ler.java:199)
                   at
              org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTes
              tRedirector.java:149)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                   at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
              java:213)
                   at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
              etContext.java:1265)
                   at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
              java:1631)
                   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
                   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              INFO rollbackTransaction() (196) - Der Transaktionsstatus vor dem
              Rollback: STATUS_NO_TRANSACTION
              INFO rollbackTransaction() (197) - Die Transaktion vor dem Rollback:
              [email protected]
              ERROR rollbackTransaction() (206) - Konnte die Transaktion nicht
              backrollen.
              java.lang.IllegalStateException: Transaction does not exist
                   at
              weblogic.transaction.internal.TransactionManagerImpl.rollback(Transactio
              nManagerImpl.java:228)
                   at
              weblogic.transaction.internal.TransactionManagerImpl.rollback(Transactio
              nManagerImpl.java:222)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBean.rollbackTransaction(TPC
              Bean.java:200)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.jav
              a:102)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBean
              Impl.java:130)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCBe
              anEOImpl.java:64)
                   at
              de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseCo
              mmitUnitTest.java:51)
                   at
              org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTes
              tCase.java:297)
                   at
              org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servle
              tTestCaller.java:148)
                   at
              org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCal
              ler.java:199)
                   at
              org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTes
              tRedirector.java:149)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                   at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
              java:213)
                   at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
              etContext.java:1265)
                   at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
              java:1631)
                   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
                   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              CONCLUSION
              ==========
              I'm going nuts.
              I just don't get it.
              The transaction is the same. I don't change the Connection. I start
              the Transaction at the beginning before I do anything!
              Please guys help me out.
              Thx alot.
              Stefan "it's three o'clock in the morning, my girlfriend left me, and
              my only friend is that stupid linux pinguine" Siprell
              Software-Development
              <<<<<<<<<<<<<<<<<<<<<<<<<<<
              <sitewaerts> GmbH
              Hebelstraße 15
              D-76131 Karlsruhe
              Tel: +49 (721) 920 918 22
              Fax: +49 (721) 920 918 29
              http://www.sitewaerts.de
              >>>>>>>>>>>>>>>>>>>>>>>>>>>
              

    Hi Priscilla
              (did you ever see the movie ? :-))
              Well I moved away from the idea of using bean managed transaction. I'll
              be using Container Managed Transactions. To modify the
              transactionalbehaviour I'll write proxymethods which have certain
              different containermanaged transaction properties, but which all call
              the same private methods.
              But it works! Here is my experience:
              - I was doing a DDL statement: I was trying to create new Tables, which
              is a definite "no-go"
              - pay careful attention to:
              http://edocs.bea.com/wls/docs60/jta/trxejb.html#1051405
                        and
              http://edocs.bea.com/wls/docs60/jta/trxejb.html#1051741
              and use these Settings for the Pool, don't ask me why, but it took me
              hours to find it out by myself:
                   <JDBCConnectionPool CapacityIncrement="5"
              DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
              LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
              Properties="user=xxx; password=xxx; server=xxx.xxx.xxx"
              RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
              TestTableName="Users" SupportsLocalTransaction="true"/>
              where as the server (shown as: xxx.xxx.xxx) is the TNS Name of the
              Oracle Driver.
              It works great.
              Another thing you guys might want to do is write a simple StatelessSB
              which does JDBC calls and two different database Connections.
              Then write a UnitTest which calls this bean a couple hundred times (with
              the same transaction). Have one test do clean writes, and another which
              causes some SQL-Exception (too long Data Columns, or likewise).
              Always count the entries and see if everything worked out. We're using
              this SetupConstruction to test new combinations of AS(sorry Priscilla) /
              Database / Db-Drivers to have a "standard test".
              I know my two cents were uncalled for, but it might save you some
              time.....
              thanx for your help
              Stefan
              -----Ursprüngliche Nachricht-----
              Von: Priscilla Fung [mailto:[email protected]]
              Bereitgestellt: Donnerstag, 2. August 2001 21:42
              Bereitgestellt in: transaction
              Unterhaltung: Two phase commit and bean managed transactions
              Betreff: Re: Two phase commit and bean managed transactions
              Hi Stefan,
              Looks like you have not actually begun a transaction by calling
              UserTransaction.begin(),
              so your setupTables method is really executing with no transaction
              context.
              Priscilla
              Stefan Siprell <[email protected]> wrote:
              >To all the Transaction GURUS!
              >
              >Hi guys (-and gals).
              >I've been doing J2EE for quite a while, but today was my first at
              >XA-Transactions and Bean Managed Transactions.
              >
              >Why am I doing this?
              >====================
              >Well I have to be able to controll the transactionalbehaviour of my
              >bean
              >during runtime, since some bean calls would cause a transactional
              >overflow due to the stress they would cause to the system, whereas
              >smaller bean calls need to run in one transaction.
              >-> Therefore I need Bean Managed Transactions
              >Since the bean does a call on two Database Connections it has to use
              >a
              >XA-Transaction.
              >-> Therefore I need XA-Transactions.
              >
              >Abstract
              >========
              >- I just can't get a User TransAction into the right Status it stays
              >in 'STATUS_NO_TRANSACTION' all the time
              >- Therefore the SQL Commands can be comitted 'java.sql.SQLException:
              >Does not support SQL execution with no global transaction'
              >- Therefore I can't do a rollback 'java.lang.IllegalStateException:
              >Transaction does not exist'
              >- Therefore I wrote this mail.
              >
              >I don't want to be a smart-"ass" writing such a detailed and indepth
              >mail. I just would like to show that I tried, and would like to have
              >some replies from you guys.
              >
              >Below are my configurations, code and logfiles.
              >
              >Thanx for taking your time and hope that the other people may learn
              >something as well.
              >
              >cu
              >
              >Stefan
              >
              >
              >Scenario
              >========
              >
              >used Software
              >-------------
              >Bea Weblogic (WL) 6.0 SPx (not real sure which SP i have)
              >Oracle 8.1.6 using the API-Version 8
              >
              >
              >I configured the system as follows:
              >(ofcourse I 'xxx'ed out all of the confidential data, sorry guys;-))
              >excerpt from:
              >
              >config.xml
              >----------
              ><JDBCConnectionPool CapacityIncrement="5"
              >DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="2"
              >LoginDelaySeconds="1" MaxCapacity="5" Name="oraclePool"
              >Properties="user=xxx;password=xxx;dll=ocijdbc8;protocol=thin"
              >RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
              >TestTableName="languages" URL="jdbc:oracle:thin:@xxx:1521:xxx "/>
              >
              ><!-- Since this is our Main Datasource I would not like to use a XA
              >Transaction due to performance Issues
              >and the TxDataSource:
              >-->
              >
              ><JDBCTxDataSource EnableTwoPhaseCommit="true"
              >JNDIName="finstral.datasource.fbs" Name="finstral Content Datasource"
              >PoolName="oraclePool" Targets="fbsserver"/>
              >
              ><!-- no comment required -I hope.
              >Next comes the "special" Pool
              >-->
              >
              ><JDBCConnectionPool CapacityIncrement="5"
              >DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
              >LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
              >Properties="user=xxx;password=xxx;server=xxx.xxx.xxx"
              >RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
              >TestTableName="Users" SupportsLocalTransaction="true"/>
              >
              ><!-- Well since there can only be one none XARessourceManager involved
              >in a 2PC
              >(keyword: Two Phase Commit) I will have to use a XACapable Driver for
              >the other
              >Datasource. Due to all the bugs in the oracle.xxx driver. I'll be
              >using the jdriver for oci.
              >I activated 'SupportsLocalTransaction' hoping it would solve my
              >problem - without effect. I just left in there now, since it made
              >sense me. Not?
              >Again the TxDataSource:
              >-->
              >
              ><JDBCTxDataSource EnableTwoPhaseCommit="true"
              >JNDIName="finstral.datasource.fbssecurity" Name="finstral Security
              >Datasource" PoolName="oracleSecurityPool" Targets="fbsserver"/>
              >
              ><!-- The System starts right up and can locate the test tables and
              >everything. So I think all of this stuff is working here -->
              >
              >
              >
              >ejb-jar.xml
              >-----------
              ><ejb-jar>
              >     <enterprise-beans>
              >          <session>
              >               <ejb-name>TPCTestBean</ejb-name>
              >     
              ><home>de.sitewaerts.futuna.common.test.tpcbean.TPCHome</home>
              >     
              ><remote>de.sitewaerts.futuna.common.test.tpcbean.TPC</remote>
              >     
              ><ejb-class>de.sitewaerts.futuna.common.test.tpcbean.TPCBean</ejb-class>
              >               <session-type>Stateless</session-type>
              >               <transaction-type>Bean</transaction-type>
              >          </session>
              >     </enterprise-beans>
              >     <assembly-descriptor/>
              ></ejb-jar>
              >
              ><!-- Originally I had the assembly-descriptor full of transaction
              >requirements. I thought since
              >the bean is handling all of the transaction stuff itself, it might get
              >confused by the 'container-transaction'
              >properties, and deleted them. Do I need them anyway?-->
              >
              >weblogic-ejb-jar.xml
              >--------------------
              ><weblogic-ejb-jar>
              >     <weblogic-enterprise-bean>
              >          <ejb-name>TPCTestBean</ejb-name>
              >          <stateless-session-descriptor/>
              >          <jndi-name>finstral/ejb/test_tpc</jndi-name>
              >     </weblogic-enterprise-bean>
              ></weblogic-ejb-jar>
              >
              ><!-- Nothing I have to explain here -->
              >
              >BeanCode (from the implementingBeanClass:
              >'de.sitewaerts.futuna.common.test.tpcbean.TPCBean')
              >-----------------------------------------------------------------------
              >---------------------
              >
              > public void setupTables() throws RemoteException
              > {
              > UserTransaction tx = getTransaction();
              > //getTransaction calls: 'tx = sCtx.getUserTransaction()' and does
              >some errorhandling
              >
              > log.info("Die Transaktion vor den Connections: "+tx.toString());
              > //Sorry bout the German. You should get the Message though.
              > log.info("Der Transaktionsstatus vor den Connections:
              >"+transactionStatus(tx));
              >
              > Connection conSecurity = getConnection(DATASOURCE_SECURITY, tx);
              > //gets a Connection via a DataSourceName from the JNDI tree
              > Connection conContent = getConnection(DATASOURCE_CONTENT, tx);
              >
              > log.info("Die frische Connection conSecurity: "+conSecurity);
              > log.info("Die frische Connection conContent: "+conContent);
              >
              > tearDownTable(conSecurity);
              > //Does nothing special
              > tearDownTable(conContent);
              >
              > log.info("Die Transaktion nach dem Teardown: "+tx.toString());
              > log.info("Der Transaktionsstatus nach dem Teardown:
              >"+transactionStatus(tx));
              >
              > Statement stmt = null;
              > try
              > {
              > stmt = conSecurity.createStatement();
              > //Well its getting interesting now.....
              >
              > log.info("Die Transaktion vor dem createtable: "+tx.toString());
              > log.info("Der Transaktionsstatus vor dem createtable:
              >"+transactionStatus(tx));
              > log.info("Die Connection conSecurity vor dem createtable:
              >"+conSecurity);
              > log.info("Die Connection conContent vor dem createtable:
              >"+conContent);
              >
              > stmt.executeUpdate(CREATE_TABLE);
              > //above is the row 91 -> throws: 'java.sql.SQLException: Does
              >not support SQL execution with no global transaction'
              >
              > stmt.close();
              >
              > stmt = conContent.createStatement();
              > stmt.executeUpdate(CREATE_TABLE);
              > stmt.close();
              > commitTransaction(tx);
              > }
              > catch (SQLException sqle)
              > {
              > log.error("Konnte kein table init machen", sqle);
              > rollbackTransaction(tx);
              > //The Code for this method is below
              > throw new EJBException(sqle);
              > }
              > finally
              > {
              > closeConnection(conSecurity);
              > closeConnection(conContent);
              > }
              > }
              >
              > protected void rollbackTransaction(UserTransaction tx)
              > {
              > log.info("Der Transaktionsstatus vor dem Rollback:
              >"+transactionStatus(tx));
              > log.info("Die Transaktion vor dem Rollback: "+tx.toString());
              > try
              > {
              > tx.rollback();
              > //above is row 200 -> throws: 'java.lang.IllegalStateException:
              >Transaction does not exist'
              > log.info("Der Transaktionsstatus nach dem Rollback:
              >"+transactionStatus(tx));
              > log.info("Die Transaktion nach dem Rollback: "+tx.toString());
              > }
              > catch (Exception e)
              > {
              > log.error("Konnte die Transaktion nicht backrollen.", e);
              > throw new EJBException(e);
              > }
              > }
              >
              >Log Excerpt
              >===========
              >INFO setupTables() (66) - Die Transaktion vor den Connections:
              >[email protected]
              >INFO setupTables() (67) - Der Transaktionsstatus vor den Connections:
              >STATUS_NO_TRANSACTION
              >INFO setupTables() (72) - Die frische Connection conSecurity:
              >weblogic.jdbc.rmi.SerialConnection@7c6daa
              >INFO setupTables() (73) - Die frische Connection conContent:
              >weblogic.jdbc.rmi.SerialConnection@3b425
              >INFO setupTables() (78) - Die Transaktion nach dem Teardown:
              >[email protected]
              >INFO setupTables() (79) - Der Transaktionsstatus nach dem Teardown:
              >STATUS_NO_TRANSACTION
              >INFO setupTables() (86) - Die Transaktion vor dem createtable:
              >[email protected]
              >INFO setupTables() (87) - Der Transaktionsstatus vor dem createtable:
              >STATUS_NO_TRANSACTION
              >INFO setupTables() (88) - Die Connection conSecurity vor dem
              >createtable: weblogic.jdbc.rmi.SerialConnection@7c6daa
              >INFO setupTables() (89) - Die Connection conContent vor dem
              >createtable: weblogic.jdbc.rmi.SerialConnection@3b425
              >ERROR setupTables() (101) - Konnte kein table init machen
              >java.sql.SQLException: Does not support SQL execution with no global
              >transaction
              >     at
              >weblogic.jdbc.oci.xa.XAConnection.beforeExecute(XAConnection.java:137)
              >     at
              >weblogic.jdbc.oci.xa.Statement.executeUpdate(Statement.java:112)
              >     at weblogic.jdbc.jta.Statement.executeUpdate(Statement.java:185)
              >     at
              >weblogic.jdbc.rmi.internal.StatementImpl.executeUpdate(StatementImpl.ja
              v
              >a:42)
              >     at
              >weblogic.jdbc.rmi.SerialStatement.executeUpdate(SerialStatement.java:54
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.ja
              v
              >a:91)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBea
              n
              >Impl.java:130)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCB
              e
              >anEOImpl.java:64)
              >     at
              >de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseC
              o
              >mmitUnitTest.java:51)
              >     at
              >org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTe
              s
              >tCase.java:297)
              >     at
              >org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servl
              e
              >tTestCaller.java:148)
              >     at
              >org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCa
              l
              >ler.java:199)
              >     at
              >org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTe
              s
              >tRedirector.java:149)
              >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              >     at
              >weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl
              >java:213)
              >     at
              >weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServ
              l
              >etContext.java:1265)
              >     at
              >weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl
              >java:1631)
              >     at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              >     at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >INFO rollbackTransaction() (196) - Der Transaktionsstatus vor dem
              >Rollback: STATUS_NO_TRANSACTION
              >INFO rollbackTransaction() (197) - Die Transaktion vor dem Rollback:
              >[email protected]
              >ERROR rollbackTransaction() (206) - Konnte die Transaktion nicht
              >backrollen.
              >java.lang.IllegalStateException: Transaction does not exist
              >     at
              >weblogic.transaction.internal.TransactionManagerImpl.rollback(Transacti
              o
              >nManagerImpl.java:228)
              >     at
              >weblogic.transaction.internal.TransactionManagerImpl.rollback(Transacti
              o
              >nManagerImpl.java:222)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBean.rollbackTransaction(TP
              C
              >Bean.java:200)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.ja
              v
              >a:102)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBea
              n
              >Impl.java:130)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCB
              e
              >anEOImpl.java:64)
              >     at
              >de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseC
              o
              >mmitUnitTest.java:51)
              >     at
              >org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTe
              s
              >tCase.java:297)
              >     at
              >org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servl
              e
              >tTestCaller.java:148)
              >     at
              >org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCa
              l
              >ler.java:199)
              >     at
              >org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTe
              s
              >tRedirector.java:149)
              >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              >     at
              >weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl
              >java:213)
              >     at
              >weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServ
              l
              >etContext.java:1265)
              >     at
              >weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl
              >java:1631)
              >     at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              >     at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              >
              >CONCLUSION
              >==========
              >I'm going nuts.
              >I just don't get it.
              >The transaction is the same. I don't change the Connection. I start
              >the Transaction at the beginning before I do anything!
              >Please guys help me out.
              >Thx alot.
              >
              >Stefan "it's three o'clock in the morning, my girlfriend left me, and
              >my only friend is that stupid linux pinguine" Siprell
              >Software-Development
              ><<<<<<<<<<<<<<<<<<<<<<<<<<<
              ><sitewaerts> GmbH
              >Hebelstraße 15
              >D-76131 Karlsruhe
              >
              >Tel: +49 (721) 920 918 22
              >Fax: +49 (721) 920 918 29
              >http://www.sitewaerts.de
              >>>>>>>>>>>>>>>>>>>>>>>>>>>>
              >
              >
              >
              

  • Question/issue regarding querying for uncommited objects in Toplink...

    Hi, was hoping to get some insight into this problem we are encoutering…
    We have this scenario were we are creating a folder hierarchy (using Toplink)
    1. a parent folder is created
    2. child elements are created (in the same transaction as step 1),
    3. we need to lookup the parent folder and assign it as the parent
    of these child elements
    4. end the transaction and commit all data
    In our system we control access to objects by appending a filter to the selection criteria, so we end up with SQL like this example
    (The t2 stuff is the authorization lookup part of the query.) ;
    SELECT t0.ID, t0.CLASS_NAME, t0.DESCRIPTION, t0.EDITABLE,
    t0.DATE_MODIFIED, t0.DATE_CREATED,
    t0.MODIFIED_BY, t0.ACL_ID, t0.NAME, t0.CREATED_BY,
    t0.TYPE_ID, t0.WKSP_ID, t1.ID, t1.LINK_SRC_PATH,
    t1.ABSOLUTE_PATH, t1.MIME_TYPE, t1.FSIZE,
    t1.CONTENT_PATH, t1.PARENT_ID
    FROM XDOOBJECT t0, ALL_OBJECT_PRIVILEGES t2,
    ARCHIVEOBJECT t1
    WHERE ((((t1.ABSOLUTE_PATH = '/favorites/twatson2')
    AND ((t1.ID = t2.xdoobject_id)
    AND ((t2.user_id = 'twatson2')
    AND (bitand(t2.privilege, 2) = 2))))
    AND (t1.ID = t0.ID))
    AND (t0.CLASS_NAME = 'oracle.xdo.server.repository.model.Archivable'))
    When creating new objects we also create the authorization lookup record (which is inserted into a different table.) I can see all the objects are registered in the UOW identity map.
    Basically, the issue is that this scenario all occurs in a single transaction and when querying for the newly created parent folder, if the authorization filter is appended to the query, the parent is not found. If I remove the authorization filter then the parent is found correctly. Or if I break this up into separate transactions and commit after each insert, then the parent is found correctly.
    I use the conformResultsInUnitOfWork attribute on the queries.
    This is related to an earlier thread I have in this discussion forum;
    Nested UnitOfWork and reading newly created objects...
    Thanks for any help you can provide,
    -Tim

    Hi Doug, we add the authorization filter directly in the application code as the query is getting set up.
    Here are some code examples; 1) the first is the code to create new object in the system, followed by 2) the code to create a new authorization lookup record (which also uses the first code to do the actual Toplink insert), then 3) an example of a read query where the authorization filter is appended to the Expression and after that 4) several helper methods.
    I hope this is of some use as it's difficult to show the complete flow in a simple example.
    1)
    // create new object example
    public Object DataAccess.createObject(....
    Object result = null;
    boolean inTx = true;
    UnitOfWork uow = null;
    try
    SessionContext sc = mScm.getCurrentSessionContext();
    uow = TLTransactionManager.getActiveTransaction(sc.getUserId());
    if (uow == null)
    Session session = TLSessionFactory.getSession();
    uow = session.acquireUnitOfWork();
    inTx = false;
    Object oclone = (Object) uow.registerObject(object);
    uow.assignSequenceNumbers();
    if (oclone instanceof BaseObject)
    BaseObject boclone = (BaseObject)oclone;
    Date now = new Date();
    boclone.setCreated(now);
    boclone.setModified(now);
    boclone.setModifiedBy(sc.getUserId());
    boclone.setCreatedBy(sc.getUserId());
    uow.printRegisteredObjects();
    uow.validateObjectSpace();
    if (inTx == false) uow.commit();
    //just temp, see above
    if (true == authorizer.requiresCheck(oclone))
    authorizer.grantPrivilege(oclone);
    result = oclone;
    2)
    // Authorizer.grantPrivilege method
    public void grantPrivilege(Object object) throws DataAccessException
    if (requiresCheck(object) == false)
    throw new DataAccessException(
    "Object does not implement Securable interface.");
    Securable so = (Securable)object;
    ModulePrivilege[] privs = so.getDefinedPrivileges();
    BigInteger pmask = new BigInteger("0");
    for (int i = 0; i < privs.length; i++)
    BigInteger pv = PrivilegeManagerFactory.getPrivilegeValue(privs);
    pmask = pmask.add(pv);
    SessionContext sc = mScm.getCurrentSessionContext();
    // the authorization lookup record
    ObjectUserPrivilege oup = new ObjectUserPrivilege();
    oup.setAclId(so.getAclId());
    oup.setPrivileges(pmask);
    oup.setUserId(sc.getUserId());
    oup.setXdoObjectId(so.getId());
    try
    // this recurses back to the code snippet from above
    mDataAccess.createObject(oup, this);
    catch (DataAccessException dae) {
    Object[] args = {dae.getClass().toString(), dae.getMessage()};
    logger.severe(MessageFormat.format(EXCEPTION_MESSAGE, args));
    throw new DataAccessException("Failed to grant object privilege.", dae);
    3)
    // example Query code
    Object object = null;
    ExpressionBuilder eb = new ExpressionBuilder();
    Expression exp = eb.get(queryKeys[0]).equal(keyValues[0]);
    for (int i = 1; i < queryKeys.length; i++)
    exp = exp.and(eb.get(queryKeys[i]).equal(keyValues[i]));
    // check if need to add authorization filter
    if (authorizer.requiresCheck(domainClass) == true)
    // this is where the authorization filter is appended to query
    exp = exp.and(appendReadFilter());
    ReadObjectQuery query = new ReadObjectQuery(domainClass, exp);
    SessionContext sc = mScm.getCurrentSessionContext();
    if (TLTransactionManager.isInTransaction(sc.getUserId()))
    // part of a larger transaction scenario
    query.conformResultsInUnitOfWork();
    else
    // not part of a transaction
    query.refreshIdentityMapResult();
    query.cascadePrivateParts();
    Session session = getSession();
    object = session.executeQuery(query);
    4)
    // builds the authorzation filter
    private Expression appendReadFilter()
    ExpressionBuilder eb = new ExpressionBuilder();
    Expression exp1 = eb.getTable("ALL_OBJECT_PRIVILEGES").getField("xdoobject_id");
    Expression exp2 = eb.getTable("ALL_OBJECT_PRIVILEGES").getField("user_id");
    Expression exp3 = eb.getTable("ALL_OBJECT_PRIVILEGES").getField("privilege");
    Vector args = new Vector();
    args.add(READ_PRIVILEGE_VALUE);
    Expression exp4 =
    exp3.getFunctionWithArguments("bitand",args).equal(READ_PRIVILEGE_VALUE);
    SessionContext sc = mScm.getCurrentSessionContext();
    return eb.get("ID").equal(exp1).and(exp2.equal(sc.getUserId()).and(exp4));
    // helper to get Toplink Session
    private Session getSession() throws DataAccessException
    SessionContext sc = mScm.getCurrentSessionContext();
    Session session = TLTransactionManager.getActiveTransaction(sc.getUserId());
    if (session == null)
    session = TLSessionFactory.getSession();
    return session;
    // method of TLTransactionManager, provides easy access to TLSession
    // which handles Toplink Sessions and is a singleton
    public static UnitOfWork getActiveTransaction(String userId)
    throws DataAccessException
    TLSession tls = TLSession.getInstance();
    return tls.getTransaction(userId);
    // the TLSession method, returns the active transaction (UOW)
    // or null if none
    public UnitOfWork getTransaction(String uid) {
    UnitOfWork uow = null;
    UowWrapper uw = (UowWrapper)mTransactions.get(uid);
    if (uw != null) {
    uow = uw.getUow();
    return uow;
    Thanks!
    -Tim

  • Configuration of two-phase-commit in OC4J 10.1.2

    Configuration of two-phase-commit in OC4J 10.1.2 in application with multiple modules
    We have an application ear file consisting of ejb-modules (mdb and slsb) and two web-modules. We are using Oracle's advanced queueing for messaging and CMT (all ejb use the Required transaction attribute). We need different datasources (OrionCMTDataSource) including that for aq, so we need two-phase-commit. The web clients use ejbs and browse the messaging system. Our 'orion-application.xml' includes a commit-coordinator configuration, and the database is setup correctly. The configuration works fine for mdbs, when sending messages to the queues. When a client starts after messages have been sent and consumed by the mdbs, oc4j complains that no commit-coordinator is defined in 'server.xml'. If we start the client first, it can access the queues, but then the mdbs complain. It seems that the first one "gets" the commit-coordinator and the second one fails.
    Some questions:
    Why isn't the second client type using the commit-coordinator configuration of the "orion-application.xml"?
    Is such scenario not supported by OC4J?
    How can I setup the application correctly?
    How do I configure commit-coordinator with different datasources to the same database? (Commit-Coordinator is also this database)

    Take a look 'How to Use a Custom Serializer with Oracle Application Server Web Services' [1].
    In your case, you should be looking at BeanMultiRefSerializer (org.apache.soap.encoding.soapenc), which will serialize your data using href and providing a way to deal with cycles.
    All the best,
    Eric
    [1] http://www.oracle.com/technology/tech/webservices/htdocs/samples/serialize/index.html

  • Emulate Two-Phase Commit

    HI,
    <Mar 20, 2009 8:25:32 AM EDT> <Error> <HTTP> <BEA-101017> <[weblogic.servlet.internal.WebAppServletContext@1c1ac17 - appName
    : 'lms-app', name: 'lms', context-path: '/lms'] Root cause of ServletException.
    javax.ejb.EJBException: nested exception is: javax.ejb.TransactionRolledbackLocalException: EJB Exception: ; nested exception is: javax.ejb.EJBException:
    nested exception is: javax.ejb.CreateException:
    nested exception is: java.sql.SQLException: Connection has already been created in this tx context for pool named ejbDS. Illegal attempt to create connection from another pool: liveDS
    I enabled Emulate Two-Phase Commit option for both the datasources ejbDS and liveDs. But still this error is coming in weblogic 9.2.2.
    Can anybody suggest?
    Thanks
    Naveen

    Hi Venki,
    I have encountered the same issue for WebLogic 10.3.Speculating that you have fixed the error for 9.2, could you please provide your inputs on how to fix these kind of issues.
    Thnks
    Pavan

  • Hierarchical Query for Chart of Account

    Hellow all
    I have one Table which is for chart of account
    The Column in this Table is
    Acc_id and Acc_name
    I Insert data in This chart of account
    Insert into COA
    values
    *(01,'ASSETS');*
    values
    *(01001,'Current Assets');*
    values
    *(01002,'Fixed Assets');*
    values
    *(010010001,'Banks');*
    values
    *(010010002,'Cash');*
    values
    *(01001000100001,'Metrol Politan Bank');*
    values
    *(01001000100002,'Royal Bank');*
    values
    *(01001000100003,'Stander Charted Bank');*
    values
    *(01001000200001,'Cash in Hand');*
    values
    *(01001000200002,'Patty Cash');*
    That's all my record now i need to create a Hierarchical tree
    Which look like this
    *01- Assets*
    ------010001 Current Assets+
    ----------010010001 Bank+
    --------------01001000100001 Metrol Politan Bank+
    --------------01001000100002 Royal Bank+
    --------------01001000100003 Stander Charted Bank+
    ----------010010002 Cash+
    --------------01001000200001 Cash in Hand+
    --------------01001000200002 Patty Cash+
    ------010002 Fixed Assets+
    ----------010020001 Machinery Assets+
    --------------01002000100001 Needle Machine+
    --------------01002000100002 GGT Machine+
    ----------010020002 Computer Assets+
    --------------01002000200001 Computer Server+
    --------------01002000200002 Computer other+
    Hope you guys understand i need the Hierarchical query for making this kind of Tree
    Regards
    Shahzaib

    In above posts you have solution to your problem but maybe you can think about changeing the design slightly.
    I would suggest using parent_id to find parent account, instead of operations on strings which can be slower in larger tables.
    SQL> create table t14(id int, account_code varchar2(16), account_name varchar2(32), parent_id int)
      2  /
    Table created.
    SQL> insert into t14 values(1,'01','Assets',null);
    1 row created.
    SQL> insert into t14 values(2,'01001','Current Assets',1);
    1 row created.
    SQL> insert into t14 values(3,'01002','Current Assets',1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from t14;
            ID ACCOUNT_CODE     ACCOUNT_NAME                      PARENT_ID
             1 01               Assets
             2 01001            Current Assets                            1
             3 01002            Current Assets                            1
    SQL> select lpad(' ',2*(level-1)) || account_code as account_code, account_name
      2  from t14
      3  start with parent_id is null connect by prior id = parent_id
      4  /
    ACCOUNT_CODE                   ACCOUNT_NAME
    01                             Assets
      01001                        Current Assets
      01002                        Current AssetsWith kind regards
    Krystian Zieja

Maybe you are looking for

  • I deleted my videos and photos by mistake, how can I get them back? I back up my phone on 2 Jan 2015

    Trying to restore back up and it's asking for PASSWORD TO UNLOCK YOUR PHONE BACKUP? Anyone can help please

  • Global variable in debugging

    Hi, I want to debug some procedures in a package and I define some global variable in the package body When procedure exits,the global variable can't be keep,when another procedure starts this variable always be set to null. How can I keep its value

  • Bookmarks in Adobe Reader iOS

    Hello, How to see bookmarks on iPad?  The file I have has already bookmarks created on Acrobat writer desktop version. I have the latest version of the iPad app and my file is large around 450 pages.  The file has been saved to see Bookmarks panel an

  • Unable to view image

    Hello.  I have a satellite l305-s5970 with vista.  I am having trouble with viewing wiring diagrams from a website I use for work.  The other computers at work have no trouble.  My unit shows images in all other sites.  What appears instead of the im

  • Saxon parser - use in OSB/ALSB

    Hi All, We are considering use saxon to replace Oracle/BEA's internal xslt parser to increase performance , i would like to know if anybody has experience with this. As when i change to use saxon i also get following exception. Throwable: javax.xml.s