Transaction question

Hi there,
          I have a stateless session bean. In one of the bean method, I get our
          database connection pool to do a selection query against database. From the
          query result, I determinate what data to insert by calling an entity bean.
          The stateless session bean is marked as transaction required. Will all the
          actions in the same transaction?
          I want to make sure the selected table(data) is locked till I finish
          the insert using entity bean.
          Thank you
          

Answers are inline.
          Shiva.
          Chi-Ming Yang wrote:
          > Hi there,
          > I have a stateless session bean. In one of the bean method, I get our
          > database connection pool to do a selection query against database. From the
          > query result, I determinate what data to insert by calling an entity bean.
          > The stateless session bean is marked as transaction required. Will all the
          > actions in the same transaction?
          Yes all the actions will be in the same transaction if you have your entity
          beans transaction level as required/supports/mandatory.
          >
          > I want to make sure the selected table(data) is locked till I finish
          > the insert using entity bean.
          Check out with an isolation level like TRANSACTION_SERIALIZABLE.
          >
          >
          > Thank you
          

Similar Messages

  • More Transaction Questions

    I posted this under an answered question but realized I should have started a new thread.
    Some more questions on transactions:
    XmlTransaction txn = DBManager->Manager->createTransaction();
    res = DBManager->Manager->query(txn, query.str(), queryContext, 0);
    XmlValue on;
    while( res.next(on) )
    c->Response += on.asString();
    txn.commit();
    In the above code does the txn.commit() have to happen after the processing of the result? In other words what happens if the transaction is committed before the while loop?
    Second question, in another section of the code I am doing similar to the above the difference is the query result is a list of documents to be deleted so the while loop is more like this:
    while( res.next(on) )
    container->deleteDocument(txn, on.asString(), context);
    If I am deleting several thousand documents (in this case 2300) will there be an issue with the transaction being able to hold that many deletes?

    Hello,
    2 good questions.
    1. It depends. If you have returned constructed content (e.g. return <foo>{...}</foo>) where the values will not refer to the container nodes then you can safely commit right after the query unless you are using lazy evaluation, in which case you cannot commit until you are done iterating. If any results may point into the container you cannot commit until you've processed them all or can otherwise guarantee that you won't touch the container outside the transactions.
    If you violate the rule you'll get an exception saying so.
    2. 2300 results isn't that large. The issues related to deleting so much content in a single transaction include:
    a. a lot of data written to the log at commit time
    b. using a fair bit of resource in terms of locks, etc
    c. concurrency -- holding off other operations. document deletion is at least as time-consuming as insertion
    If any of these are real problems for you, you could copy the document names somewhere and delete them in bite-size chunks in separate transactions.
    Regards,
    George

  • Just another cmp transaction question

    Hi
    I would like to know if it is possible to manage cmp transaction from the client code. For example I need to
    execute some business method several times but I don't want the container to commit transaction after each execute but only if all executes were successfull.
    Bartek

    I think I understand your post but my problem is rather different. I have a session bean with a business method named process(..) that receives as an argument a org.dom4j.Document object and does an proper action. I works fine when that process() method is called only one . But now I wan't to call it several times , each time with different org.dom4j.Document perhaps and want to have tha transaction commited only after complete whole process. I am quite new I ejbs so it is possible that is quite a silly question but I need surety that the only way to do this is to make an another session bean business method that gets as a parameter for example a collection of org.dom4j.Document objects.
    Thanks for help
    Bartek

  • Transaction questions

    Howdy all.
    I have some questions about transactions. I have a particular function that does some dynamic stuff. It creates a table dynamically, creates some indexes on the table dynamically, and grants rights to the table dynamically. I am building a string for each of these actions dynamically and executing it. Then the procedure does some other things like inserting in some tables and such. If any part of the function does not finish successfully, I would like to rollback whatever has been done. I would also like to return the initial error with original line number to the caller of the function.
    I have tried some SET TRANSACTION READ WRITE stuff with COMMIT WORK at the end of successful completion and ROLLBACK WORK in an exception handler at the end of the function. But I am having problems getting Oracle to rollback all work and return the original error to the caller.
    Here is the basic layout of what I want.
    BEGIN
    <execute immediate to create table>
    <execute immediate to create indexes on table>
    <execute immediate to grant rights to table>
    <do inserts and other non-dynamic stuff>
    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK WORK;
    RAISE <original error with line numbers>;
    RETURN (1);
    END;
    If an error happens after the creation of the table, I want the create table to be rolled back. I realize that I could just manually drop table in my exception handler, but I have several cases like this that I would like to handle with transactions instead of large exception handlers.
    Any help would be appreciated. I can explain more if needed.
    wally

    DDL issues COMMIT before and after the statement. Consequently, it cannot be rolled back. If you want to drop the tables you'll have to explicitly call the DROP statement.
    I'm not a big fan of functions to do this sort of thing, because table creation, etc ought not to be done on the fly. It should be done in a controlled fashion, in a script. Apart from anything else, a script gives you:
    (1) a record of what exactly was run, in case you need to run it again.
    (2) something that can be stowed in source control repository.
    There's no reason why the production of that script cannot be automated.
    Cheers, APC

  • Basic JDBC transactional question

    Hello all,
    I have (what I believe) is a basic transactional JDBC question.
    Here's what I want to do:
    begin transaction
    select a row from a table where (some condition).
    that row may or may not exist.
    if the row exists: update the row
    else if the row does not exist, insert a new row
    end transaction
    I want this entire thing to be atomic .. I don't want the select to complete, then have something else come in there before the update/insert takes place.
    I'm using MySQL .. I seem to remember hearing about some proprietary MySQL command which would do a SELECT + UPDATE atomically .. which would be fine, but I can't find it.
    Wrapping this with a row-level lock would be fine too .. I'm just not sure how to do that in JDBC.
    Thanks!
    -d

    By thte way, and not that it helps the orignal poster, who's using MySQL, but Oracle has a proprietary MERGE statement that does "insert or update" in one go. For example:
    MERGE INTO bonuses D
       USING (SELECT employee_id, salary, department_id FROM employees
       WHERE department_id = 80) S
       ON (D.employee_id = S.employee_id)
       WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
         DELETE WHERE (S.salary > 8000)
       WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
         VALUES (S.employee_id, S.salary*0.1)
         WHERE (S.salary <= 8000);

  • JMS Transaction Questions

              Greetings,
              I have the following questions regarding Transactions in JMS:
              1. What constitutes a transaction in JMS? Assuming there are 2 clients, one which
              is just a Subscriber and the other just a Publisher. What will constitute a transaction
              in this scenario?
              2. While configuring, JMS Connection Factory, a parameter present is " Transaction
              Timeout ", with a defualt value of 3600 secs. At what point, does this time starts
              ticking ? Is there anyway to disable this value or the only solution is to increase
              it as required.
              

              vinay s wrote:
              > Greetings,
              >
              > I have the following questions regarding Transactions in JMS:
              > 1. What constitutes a transaction in JMS? Assuming there are 2 clients, one which
              > is just a Subscriber and the other just a Publisher. What will constitute a transaction
              > in this scenario?
              >
              A receive or send operation performed under a transaction. The operation
              becomes transactional.
              >
              > 2. While configuring, JMS Connection Factory, a parameter present is " Transaction
              > Timeout ", with a defualt value of 3600 secs. At what point, does this time starts
              > ticking ? Is there anyway to disable this value or the only solution is to increase
              > it as required.
              This applies to transacted sessions. A special kind of transactional behavior
              unique to JMS. WL JMS also supports user transactions (JTA), which
              is more unique.
              Note that 3600 seconds is a long time, standard transactions actually
              default to a limit of 30 seconds...
              To learn about this stuff, I recommend reading the WebLogic JMS Programmer's guide - there
              is a chapter on
              transactions. Check out the performance white-paper I posted to this newsgroup last
              Thursday - there is
              a section in there on transacted sessions vs. user transactions...
              

  • Call Transaction question

    Hi All
    I am developing a program which read a list of transactions(t_progs)and run them one by one and them store in an  internal table(t_progsErr) all the transactions that was NOT execute successfull  .
    But the problem is that some of this transactions has obrigatory parameters which might occur in errors.
    Anyone has an idea how can I solve this ?
    The code is somethin like this:
    loop at t_progs.
        select single *
        from tstc
             where pgmna = t_progs-name.
        call transaction tstc-tcode.
        commit work and wait.
       check if the line after start of selection was     executed and record in case of error****
              move-corresponding t_progs to t_progsErr.
    endloop.
    Thank you very much in advanced.
    Br.
    Cristina

    hi,
    <b>Call transaction     <tcode> using <BDCTAB>
         Mode <A/N/E>
         Update <S/A>
         Messages into <MSGTAB>.
    </b>
    Parameter – 1     is transaction code.
    Parameter – 2     is name of BDCTAB table.
    Parameter – 3     here you are specifying mode in which you execute transaction
              A is all screen mode.  All the screen of transaction are displayed.
              N is no screen mode. No screen is displayed when you execute the transaction.
         E is error screen. Only those screens are displayed wherein you have error record.
    Parameter – 4     here you are specifying update type by which database table is updated.
         S is for Synchronous update in which if you change data of one table then all the related Tables gets updated. And sy-subrc is returned i.e., sy-subrc is returned for once and all.
         A is for Asynchronous update. When you change data of one table, the sy-subrc is returned. And then updating of other affected tables takes place.  So if system fails to update other tables, still sy-subrc returned is 0 (i.e., when first table gets updated).
    Parameter – 5     when you update database table, operation is either successful or unsuccessful or operation is successful with some warning. These messages are stored in internal table, which you specify along with MESSAGE statement. This internal table should be declared like BDCMSGCOLL, a structure available in ABAP/4. It contains the following fields:
    Regards,
    Santosh

  • Distributed transaction question

    I'm implementing distributed transactions between two oracle servers and am confused as to how this can work reliably. I see that I must call prepare then commit. If prepare fails then I must call rollback instead of commit. However, if I call prepare on each database and get a success from each one and then call commit the commit can throw an exception. ie:
    database 1
    database 2
    call prepare for database 1 - success
    call prepare for database 2 - success
    call commit for database 1 - succes
    call commit for database 2 - failure
    now what? how is this beter than just calling commit not using distributed transactions? I thought that any errors for commit must be given by prepare otherwise what is the purpose of calling prepare?
    Calvin R. Smith

    As part of the 2PC contract, during the prepare phase, the resource manager
    is required to prepare itself in such a way (e.g. acquire necessary locks,
    perform necessary integrity constraint validation, do logging etc) that it
    can successfully commit or rollback the transaction branch according to the
    final commit/rollback call from the transaction manager. If they are unable
    to prepare themselves, they are given a chance to report that early to the
    transaction manager by returning an error on prepare. For the 2PC protocol
    to achieve atomically, it is imperative that all resource managers take this
    contract seriously.
    While it is impossible to provide a completely fool-proof guarantee,
    resource managers should make every effort to honor that. On rare,
    catastrophic occasions where they are unable to fulfill the contract, they
    are allowed to return a Heuristic error upon the subsequent commit/rollback
    call issued by the transaction manager. It should be noted that heuristic
    errors are considered very rare events in distributed transactions, as
    compared to commit failures for local (non-XA) transactions.
    Regards,
    Priscilla
    Calvin R. Smith <[email protected]> wrote in message
    news:3be18096$[email protected]..
    I'm implementing distributed transactions between two oracle servers and am
    confused as to how this can work reliably. I see that I must call prepare
    then commit. If prepare fails then I must call rollback instead of commit.
    However, if I call prepare on each database and get a success from each one
    and then call commit the commit can throw an exception. ie:
    database 1
    database 2
    call prepare for database 1 - success
    call prepare for database 2 - success
    call commit for database 1 - succes
    call commit for database 2 - failure
    now what? how is this beter than just calling commit not using distributed
    transactions? I thought that any errors for commit must be given by prepare
    otherwise what is the purpose of calling prepare?
    Calvin R. Smith

  • Transaction Question  - its behaviour ???

    I am trying to understand the transaction behaviour of the company object.
    if I start a transaction and start editing Orders, will that mean a user logged on to SAP cannot amend/delete/ update Orders during the life of that transaction?
    If not, how can I make that happen(stop users from edit/ipdate/delete of orders)?
    is this transaction similar to what SQL Server offers?
    thanks for any type of input.
    Indika.

    The transaction function of the company object applies only to the di not to the ui.
    All updates, delete, adds between a transaction start and commit are treated as one. this means that if your application fails all updates/deletes/add since the last start transaction are reversed.
    Only when you commit the transaction the changes are applied permanently.
    To prevent users from changing orders you must use the di to manipulate the order screen.

  • EJB transaction question in ejbCreate

    I have 2 Entity EJBs participating in an relationship. Order - LineItem. I'm creating the LineItem in the the ejbPostCreate of Order.
    When I encountered a duplicate key for Order in Order's ejbCreate, I was not expecting the LineItem to be created, I thought a rollback would occur.
    What do I need to do to ensure a rollback occurs. And it looks like the container called ejbPostCreate even though ejbCreate threw an exception. Can I get around this?
    thanks in advance!

    I'll post an simple one to many relation ship example..
    order table:
    orderPK int
    orderId int
    line item table:
    lineItemPK int
    lineItemId int
    orderId int
    abstract PModel
    public abstract class OrderBean implements EntityBean
    public Collection getLineItems();
    public void setLineItems(Collection lineItems);
    publi interface LineItemLocal extends EJBLocalObject
    public Integer getLineItem();
    public void setLineItem(Integere value);
    bean class for LineItem
    public class LineItemBean implements EntityBean
    public Inbteger ejbCreate(Integer lineItem)
    setLineItem(lineItem);
    return null;
    public void ejbPostCreate(Intger lineItem)
    public abstract Integer getId();
    public abstract Integer setId();
    //entity bean methods
    public abstract class OrderBean implements EntityBean
    public void addLineItem(Integer lineItem)
    InitialContext cntx=new InitialContext();
    LineItemHomeLocal lineItemHome=cntx.lookup("LineItemHomeLocal");
    lineItemLocal lineItemLocal=lineItemHome.create(lineItem);
    Collection lineItems=this.getLineItems();
    lineItems.add(lineItemLoacl);
    schema defnition:
    <relationships>
    <ejb-relation>
    <ejb-relation-name>Order-LineItems</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>orderHasLineitem</ejb-relationship-role-name>
    <mutiplicity>one</multiplicity>
    <relationship-role-source>OredrBean</relationship-role-source>
    <cmr-field>
    <cmr-field-name>lineItems</cmr-field-name>
    <cmr-field-type>Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>LineItembelongstooredr</ejb-relationship-role-name>
    <mutiplicity>many</multiplicity>
    <relationship-role-source>LineItemBean</relationship-role-source>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>

  • Is it possible to use BAPI-ALE to send an idoc using the message control?

    Hi Guys
    Is it possible to use BAPi-ALE to send an IDOC using a message control?
    I have configured the system to send an IDOC when a outbound delivery is saved in the system.
    I have done the following.
    1). I am using the std BAPI-ALE interface provided by the object type LIKP.
    2). I am using the method SAVEREPLICA for which an interface already exists in BDBG transaction.
    3). I hace created a distribution model in BD64 and added the BAPI - LIKP and SAVEREPLICA
    4). Created a partner profile ( using the generate partner profile option in the BD64 transaction )
    QUESTION:
    1). How do i associate the custom OUTPUT type created for Delivery ?
    2). I tried to associate the custom output type in the Partner profile definition under the message control tab but i am not sure which Process code to be used? Since the partner profile was generated automatically from BD64 it has an entry for SHP_OBDLV_SAVE_REPLICA as a message type in the outbound parameters. and i am unable to find a process code for this Message type in WE41. So what process code should i use in the Message control tab against the custom output type?
    3). Do i need to leave the message control tab empty without making any entry? If yes then how would the system come to know that it needs to trigger this partner profile when the custom output type is proposed by the system?
    will award points for useful answers
    Edited by: Workflow  learner on May 29, 2008 8:49 PM

    "any way"
    Applications such as ScreenRecycler, http://www.screenrecycler.com/ScreenRecycler.html, can do it.

  • Same Code Fails in OC4J 9.0.3

    In an effort to find a solution to my transactional problem (See my other question in this forum marked URGENT), I started playing with OC4J 9.0.3 to see if that would make any difference. However, what I have found has all but compelled me to go "Office Space" on my computer. I cannot even find an answer to my transaction question because my code doesn't make it to that point. The first stage in the transaction is the parsing of am XML document. I have a class that wraps Oracle's XML parser V2 to do the parsing, and it works perfectly on OC4J 9.0.2.0.0. On 9.0.3, the parser fails because it seems to be finding these stray tags in the document that just aren't actually there. The code and the file are absolutely identical between the working case and the failing case; only the server version is different. So in trying to solve one problem, I have discovered a completely different one. Can anyone offer a possible explanation?
    Thanks a lot.

    In an effort to find a solution to my transactional problem (See my other question in this forum marked URGENT), I started playing with OC4J 9.0.3 to see if that would make any difference. However, what I have found has all but compelled me to go "Office Space" on my computer. I cannot even find an answer to my transaction question because my code doesn't make it to that point. The first stage in the transaction is the parsing of am XML document. I have a class that wraps Oracle's XML parser V2 to do the parsing, and it works perfectly on OC4J 9.0.2.0.0. On 9.0.3, the parser fails because it seems to be finding these stray tags in the document that just aren't actually there. The code and the file are absolutely identical between the working case and the failing case; only the server version is different. So in trying to solve one problem, I have discovered a completely different one. Can anyone offer a possible explanation?
    Thanks a lot. Hi Neil --
    Sorry to see that you ran into this trying to test out the TX issue.
    Can you post a code snippet on how you are using the parser - or perhaps even send me your test case if you are able to ([email protected]) - and some more details on what you are seeing (the phantom tags)
    If you are a supported customer, then can I also ask you to log a TAR for this with support so we can have our support organization track it and also work on the issue.
    cheers
    -steve-
    cheers
    -steve-

  • View Postings and Messages for Valuation and Translation

    Hi Everyone,
    Inevitably after valuation (FAGL_FC_VAL) or translation (FAGL_FC_TRANS) is run at month-end and the user exits out of the transaction, questions arise as to how certain items were revalued or translated.  What I'm trying to locate is if there is a way to retrieve the details from the "Posting", "Messages" and main screen view of the transaction AFTER the user has exited the transaction.  Are those logs stored somewhere or is there a way to recreate the data somehow?
    These are the items that I would like to be able to retrieve at anypoint:
    The program generates three lists:
    List of valuated line items or G/L account balances
    List of postings or posting proposals
    List of messages (own spool file)
    Thanks,
    Pete
    Edited by: Peter Zaborowski on Apr 26, 2010 3:04 PM

    Hello,
    Unfortunately, there's no option in standard functionality to realize the requirement.
    One workaround is to identify all valuation/reversal documents. For valuation document, BKPF-BKTXT is filled with "FC Valuation" and reversal with "Reverse posting", so it's not difficult to identify documents.
    Also processed documents and valuation difference is stored in table FAGL_BSBW_HISTRY (for items) FAGL_BSBW_HST_BL (for balance). Maybe these tables contain necessary info.

  • JMS Session and Container Managed Tx

              Hello,
              We have encountered the following problem:
              1) A Transaction was initiaited by the Container on EJB1.a() ("Required"-in CMT)
              2) a topic jms session was initiated by: cSession = connection.createTopicSession(
              false, TopicSession.AUTO_ACKNOWLEDGE );
              3) When I rollback the tx, all but the jms sendings roolback. Meaning the jms
              session was not a part of the tx.
              How do I relate between a jms session and a container transaction. Do I necessarily
              have to use user transaction to solve this problem?
              Many thanks in advance,
              

    Danger. Please read in-line comment.
              David Maddison wrote:
              > Hi Daniel,
              >
              > The topic session you've created isn't a transactional one, (you supplied
              > false to the transactional parameter)
              >
              > You need to use :
              >
              > cSession = connection.createTopicSession(true,
              > TopicSession.AUTO_ACKNOWLEDGE );
              >
              > To create a transactional session which will be enrolled in the CMT
              > transaction.
              >
              This is 100% wrong. Making a session transacted specifically causes JMS
              to ignore any existing transaction in favor the session's internal transaction,
              as required by the JMS specification. You need to use a connection
              that specifically checks for JTA (user) transactions. Either use an
              XAConnection
              or use a connection factory with the "user transactions enabled" flag set.
              There are number of transaction
              questions answered in the FAQ, they should point you in the right
              direction:
              http://e-docs.bea.com/wls/docs61/faq/jms.html
              The JMS programmer's guide also has this information.
              Tom, BEA
              >
              > David Maddison
              >
              > "Daniel Gordon" <[email protected]> wrote in message
              > news:[email protected]...
              > >
              > > Hello,
              > >
              > > We have encountered the following problem:
              > >
              > > 1) A Transaction was initiaited by the Container on EJB1.a()
              > ("Required"-in CMT)
              > > 2) a topic jms session was initiated by: cSession =
              > connection.createTopicSession(
              > > false, TopicSession.AUTO_ACKNOWLEDGE );
              > >
              > > 3) When I rollback the tx, all but the jms sendings roolback. Meaning the
              > jms
              > > session was not a part of the tx.
              > >
              > > How do I relate between a jms session and a container transaction. Do I
              > necessarily
              > > have to use user transaction to solve this problem?
              > >
              > > Many thanks in advance,
              > >
              > >
              

  • Automatic Payment Transaction (F110) - questions bout Paymnt Doc generated

    Hi all,
    I have a question regarding to payment documents generated by Automatic Payment Transaction (tcode F110).
    After a payment run, some payments are created. But I found that same payment documents are generated over several payment runs for same vendors. And those payments pay for the same invoices.
    For example
    Run date   ____________     ID    ______     Vendor ______  Payment
    Jan 01, 2009  ______  ID001  ______  V0001  ______   P1
    Jan 15, 2009  ______  ID002  ______  V0001  ______   P1
    Jan 15, 2009  ______  ID003  ______  V0001  ______   P1
    Payment P1 pays for Invoices I1, I2, I3.
    It looks like the data is repeated.
    When I check tables, REGUH, there are 3 entries and 9 entries in REGUP (1 payment - 3 invoices => 9 records). It also is updated in BKPF and BSEG as well.
    The question is: how can I identify  which Payment Run (date, id) the payment document belongs to?
    I don't understand because i think SAP automatically generates document number, and it cannot be the same for every run.
    Please guys, help explain it for me.How does it work in this way?
    Thanks in advance

    Hello
    In this process, you will complete a payment transaction automatically.
    You should first enter some vendor invoices so that there are enough due payables available in the system. In order to reduce the work you need to do, we have created a CATT (Computer Aided Test Tool) that generates invoices automatically when activated.
    Secondly, you will create a payment program and enter the parameters necessary for selecting the items to be paid.
    Next, you will execute a payment proposal list and check its log. You will find that some items are blocked for payment. You will need to update the list in order to remove the block.
    Later, you will start an actual run. Then you will set the print program so that the payment forms and accompanying payment advice notes and payment summaries are correctly assigned to the payment run. Finally, you will print the payment forms. If you are using North American data, you will then need to analyze the check register.
    Check the link for detailed procedures
    Reg
    Suresh

Maybe you are looking for

  • .avi file won't work!

    My friend sent me a movie in .avi format. I opened it, and have no picture and no sound, yet the time ticker moves. Sometimes, I get a message from Quicktime saying "components may be missing". But since I am a technology illiterate, I don't know wha

  • Can I create a link in a text cell that will open another file?

    I am creating a template in Numbers that I can use to log meeting session data, such as length, date, notes of the meeting content, action items and then also have a field (cell) for links to outside documents relevant to the meeting or client.  I se

  • Telephony integration

    Hello, What are the steps involved in telephony integration in CIC. Please explain in detail. Thanks, Diana Kurien

  • I can't install updates in my ipad 2 after i update my ipad2 in ios 6

    Why is it that i can't install updates in my ipad2. It keeps on saying installing for the whole time.and also the u tube app is gone in my ipad 2. What's happening!!!

  • Logitech Z-5300 and Audigy ZS 5.1 PROBL

    I have read the FAQ. I have searched the posts. I have had this sound card for less than a day and I can't get 5. to test out on the THX or Creative test programs. I can get sound on all the speakers but I think it is stereo. If I swap the cables and