Record Locking using EJB

Hi,
Can anyone please explain me how to achieve Oracle Row level record locking using Enterprise Java Bean ?
Thanks for the time.
L G Goundalkar

It depends upon your container and your container-specific deployment settings. In Weblogic, you can specify database-based pessimistic locking which causes the CMP entity to hold a row-lock on load() until it is comitted or rolled back.

Similar Messages

  • How to delete a database record by using EJB entity beans

    Hi, All,
    Does anyone know how to use entity bean to delete a database record? I have all the EJB entity beans created, including access beans to each. I can successfully create records, find and update records, however, I haven't find a way to delete records yet.
    Your response is appreciated.
    Cathy

    Please see EJB Forums for continue discussion on this subject.
    Reference titile: "how to delete database record by using CMP entity beans "

  • Using EJB creating Master/Detail Record

    Hi All
    I would really in need of your help regarding how to show the information of master detail records in a single form
    eg: one text field with department Id and a Search button which should give relevent employees details working in that particular department.
    I tried with ADF business components it works fine..
    I need to do through pure Session Beans and Entity Beans(note : not thru using EJB:UseBean Tag)
    Please i will really appreciate your valuable help..
    Thanks All
    Have a Nice day
    Mohamed Anez

    Kunal:
    Use a code snippet like the following:
    --- Assuming you're in the detail EO's create method ---
    oracle.jbo.server.EntityDefImpl eDef = oracle.jbo.server.EntityDefImpl.findDefObject(<package-qualified-name-of-the-master-Entity-Object>);
    oracle.jbo.Row masterRow = eDef.findByPrimaryKey(this.getDBTransaction(), <foreign-key>);
    If the row does not exist, masterRow will be null.
    findByPrimaryKey first checks the entity cache (which will include your new master row(s)) and then go out to database (if it's not in cache).
    Thanks.
    Sung

  • How to load data in plain-text file into database by using EJB?

    Hi,
    We need to develop an on-line application which requires us to load input data
    from a selected plain-text file on the Web server (iplanet server) into the backend
    oracle database. How could I use EJB to make it happen? it seems like using Entity
    EJB is not feasible.
    Really appreciate your help!
    Corona

    Hi Corona,
    "Corona Fang" <[email protected]> wrote in message
    news:3f3b0ea3$[email protected]..
    We need to develop an on-line application which requires us to load inputdata
    from a selected plain-text file on the Web server (iplanet server) intothe backend
    oracle database. How could I use EJB to make it happen? it seems likeusing Entity
    EJB is not feasible.If you are talking about loading thousands of records,
    the preferable way is using plain JDBC calls utilizing
    batch methods.
    Regards,
    Slava Imeshev

  • How to call RFC using EJB module.

    hi,
        I want to call the RFC using EJB module in java. how to do it.
        if someone having the code plz post it.
    regards,
    Shanthakumar.

    /***Start of JRA specific code***//
    // Retrive connection factory                
    InitialContext initialcontext = new InitialContext();
    connectionfactory = (ConnectionFactory) initialcontext.lookup("java:comp/env/ConnFactory");
    //Request a connection handle:
    connection = connectionfactory.getConnection();
    //Create a RecordFactory object to get a metadata description
    // of the RFC SALERT_CREATE
    RecordFactory recordFactory = connectionfactory.getRecordFactory();
    // Create Record objects containing all
    // necessary information about the RFM.
    MappedRecord input = recordFactory.createMappedRecord("SALERT_CREATE");
    //Fill in the import parameters and the import table structure data here
    input.put("IP_CAT", "ALRT_CAT"); // alert category
    // Refer to the SW_CONT structure of the table of RFC SALERT_CREATE
    ResultSet inputITContainer = (ResultSet) input.get("IT_CONTAINER");
    int tabIndex = 0;
    inputITContainer.moveToInsertRow();
    inputITContainer.updateString("ELEMENT", "CONT_1");
    inputITContainer.updateString("TAB_INDEX", "" + tabIndex++);
    inputITContainer.updateString("ELEMLENGTH", "250");
    inputITContainer.updateString("TYPE", "C");
    inputITContainer.updateString("VALUE","Container_1 value");
    inputITContainer.insertRow();
    inputITContainer.moveToInsertRow();
    inputITContainer.updateString("ELEMENT", "CONT_N");
    inputITContainer.updateString("TAB_INDEX", "" + tabIndex++);
    inputITContainer.updateString("ELEMLENGTH", "250");
    inputITContainer.updateString("TYPE", "C");
    inputITContainer.updateString("VALUE","Container_N value");
    inputITContainer.insertRow();
    interaction = connection.createInteraction();
    // execute the call with the input parameters.
    interaction.execute(null, input);
    }catch(Exception e){
         // Error handling code goes here
    }finally{
         try {
                    if (interaction != null)
                   interaction.close();
              if (connection != null)
                   connection.close();
         } catch (Exception ignored) {
              // Do nothing
    // Pass on module data to the next module in chain, unaltered
    return moduleData;

  • Record locking

    How does Oracle 8i handle record locking?
    Is this handled completely in the background by oracle or are there explicit record locks that can be set.
    I understand that an update or insert will lock the current record and the commit and rollback will release the lock.
    I have a problem where some developers are using an odbc connection to access an oracle database while a java servlet app is accessing the same database using jdbc. At times the changes made through the servlet app are rolled back or are not processed and the changes made by the odbc connection are kept.
    I am confused as to how this could happen.
    any suggestions?

    I have a simmilar problem, where my program aborts too often with a record Lock.
    Everytime I do an update/delete I do it using the SELECT .... FOR UPDATE NOWAIT. In order to reduce the number of aborts due to record locks I'd like to try your suggestion of catching the ROW_LOCKED error, sleep(dbms_lock.sleep in PL/SQL), and retry getting the lock a certain amount of times prior to erroring out. Can You give me more details of how to do this.
    In paticular how do you use dbms_lock.sleep function/package? where can I find this package? Can you share any code examples where you have used this package.
    I greatly appreciate all teh help/suggestions you can provide to me.
    Thanks.

  • DMS - Object Links (Material master) is showing "Record Locked"

    When looking at an info record in DMS, I am on the Object links tab for Material Master.  There is now a field called "Record Locked".  Haven't seen this field before.  What does this mean that the record is locked?  Is there something that needs to be done to unlock it?

    Dear experts,
    I also seen this column. But problem is I am able to view this in my development client. But could not view in production.
    Also my observation is if I am changing the document from the Objectlink e.g. Material Master this cloumn appears automatically and allows me to do the changes in the DIR.
    But this happens in Development client same functionality I want to use in Production.
    I could not find any config part regarding this.
    Can any body help me on this to resolve this?
    Thanks in advance
    Regards
    Nitin

  • Error -2038: Record locked by another transaction / Internal error occured

    Hi, sometimes when I'm trying to update a SO via DI API, I got this error -2038. The error message varies, either: "Internal error occured" or "Record locked by another transaction". Ffor 'record locked' error, the table/field names varies, eg.
    [RDR1.ItemCode][line: 7]
    [RDR12.TaxId8][line: 1]
    [WTR1.ItemCode][line: 1]
    [RDR1.ItemCode][line: 9]
    [RDR1.ItemCode][line: 3]
    [RDR12.TaxId2][line: 1]
    [RDR12.CityS][line: 1]
    Any idea what the problem might be? FYI I'm using PL41, and this DI calls are from a centralized 'handler' VB.NET program. I've also released the instantiated BO objects via System.Runtime.InteropServices.Marshal.ReleaseComObject() (http://support.microsoft.com/kb/317109)
    Thanks.

    David: what do you mean by 'S-User for the Marketplace'? I think I'm not an S-User, so I still can't login... How can I be an S-User?
    Anyway, I'll close this question, even though it's not really solved. I can't find any other user updating the same document, but that -2038 errors still pop up.
    Currently I'm using John's approach to retry whenever I got -2038. As long as it works and everybody's happy I guess...
    Thanks everybody.

  • JavaScript error and CATW record locking problem

    Hello,
    We're having two problems with ESS (CATW and Personal Information (PZM3)) in EP 6. We have an ITS-R/3 landscape.
    The JavaScript problem appears intermittently within Personal Data services (Address, Emergency Contact, ...). The actual error reads "object required" and originates from ITS. A user may be able to click through all the ESS services once fine, but on a second click receive the error. Sometimes they can't use the services at all.
    The record locking problem happens in Time Sheet (CATW). Even though a user Saves and Releases the Time Sheet, it remains locked and cannot be approved. Alternatively, some users are experiencing locked records when they try to complete their own time sheets.
    I'm not sure if these are related.
    Has anyone here seen these problems? Any suggestions are most welcome!
    Cheers,
    Colleen

    The best way to nail down the javascript error would be to use the firefox JavaScript debugger extension plugin and put the breakpoints where the problem occurs.
    This will exactly tell you which object it is looking for which is not found. Moreover you might be able to find that when it is working fine as you said. So give that a try and I am sure you will be able to figure out the problem.
    To me this mostly looks like at time some .js file is not coming through to the browser... but this is just a wild guess based on the symptoms.

  • Record Lock

    Hi all,
       I have requirement like this. For one table i have created table maintainance generator. For data maintainance i have created one Transaction code. while one user is using that TCODE to update data for one record if another try to update another record it is not possible the total table is lock untill first user completes updating.
      But now my requirement is if one user is updating first record then another user also want access to update second record. That means record lock in table maintainance generator tcode.
    Awaiting for reply.
    Thanks & Regards,
    Swetha.

    Hi Swetha,
    Doesn't sound like a good idea from data consistency point of view, but you can give it a try using the event After locking/unlocking in the main function module by creating a form  of your own. But I'm not sure if the current record that is being processed would be visible there or not.
    Check this [link|http://help.sap.com/saphelp_47x200/helpdata/en/a1/e45217a2f511d1a5630000e82deaaa/frameset.htm] for details about events.
    KR,
    Advait

  • 32 bit Record Locking on 64 bit Novell Client 2 SP1 for Wind

    I recently installed several 64 bit Windows 7 Machines running Novell Client 2 SP1 for Windows 7.
    Our application uses 32 bit record locking in order to maintain compatibilty with a wide array of workstations.
    The problem is as follows:
    Machine A is runnning 64 bit Novell Client 2 SP1 for Windows 7
    Machine B is running 32 bit Windows XP (Client doesn't really seem to matter).
    Using Machine A, I open a table, and lock a record.
    Using Machine B, I attempt to open the same table.
    Machine B received and Error 33 - The process cannot access the file because another process has locked a portion of the file.
    When I change my application to use 64 bit record locking, the problem goes away.
    Luis

    I see that there is a better place for my post:
    OES: Client - Windows - NOVELL FORUMS
    I have posted there as well.

  • Who has the @#$% record locked!?

    I know there are hundreds of other posts asking this (I've read every one I think), but none give the whole answer (unless I haven't found that one yet). I hate to have to add another one, but I can't believe this has not been resolved due to the sheer number of people asking for this.
    Instead of the non-user friendly "Could not reserve record..." message which means nothing to the users and just generates calls to me, I want to display "User XYZ has the record locked" so the user that gets this message will call the other user instead! Should be simple, right?
    I know to use the on-lock trigger and select for update to see if the row is locked. I know to use v$lock to look for rows with the type of 'TX'. The trouble is, there will be multiple TX type rows. How do I know which one is MY row? No column in v$lock, v$locked_object or v$session seems to map to the rowid, which is the only way I know to identify MY row.
    Please, how do I relate MY row to one of the TX type rows in v$lock (or a row in v$locked_object which has the userid in it)!? Are there other system views I need to be aware of that have this info maybe?
    Thanks for any info. I'm using forms 10g (9.0.4) against the 10g database.
    Gary

    Well, I have reread your post, and maybe you can use a variant of inolau query :
    SQL> select
      2           (select osuser from v$session where sid=a.sid) blocker,
      3         a.sid,
      4           (select serial# from v$session where sid=a.sid) serial#,
      5        ' blocks ',
      6         (select osuser from v$session where sid=b.sid) blockee,
      7             b.sid, c.username username
      8    from v$lock a, v$lock b, v$session c
      9  where a.block = 1
    10     and b.request > 0
    11     and a.id1 = b.id1
    12     and a.id2 = b.id2
    13*    and b.sid = c.sid
    SQL>                                                                  You know your session id, so you know who is blocking you.

  • Database locking using JSP and Oracle database

    Dear All
    I am reading about how to do database locking in general and i want to implement these mechanisms using JSP pages and oracle database, but i have the following questions:-
    1.If i write a “select for update” quesry in the JSP page will it locks the record ? or it will not lock the record because the connection between the JSP pages and the server will be stateless in most online systems?
    2.If i write all my jave code in transaction , something like this:-
    • Begin transaction
    • Commit or
    • Rollback
    Then should i be worried about the locking issues or the database manger will handle the locking mechanisms to insure data integrity(and what the default mechanism (if any) that the oracle database manger use to do the locking)?
    3. If the answer for question 2 is no, then how can i handle the optimistic and the pentemistic locking using JSP pages?
    BR

    One way to solve this issue is as follows:
    * You add a new column to each database table called 'version' which is of int type.
    * Each time you alter any field in a record, you increament the version number.
    * When you read a record and display it, you store the version number in your code
    * when you go to update the record, you write your sql something like this:
    update person set firstName=? where personId=? and version=?
    Where the version is whatever you stored locally. If someone altered the record in the database while your
    end user was looking at it, the version numbers will not match and the sql statement will
    return zero as the number of records it altered. If its zero, inform the end user someone altered the record
    while he was looking at it and weather or not he wants to proceed.
    The chances of two people altering the same record in a table while both are logged in and viewing the same set of data is small so such collisions will be few.
    You only need transactions if you are updating more than one record at a time (in the same table or multiple tables).
    You dont need it for reading records if you use a single sql statement to read (for example: to join multiple tables).
    In general, you get a (pooled) connection, use it, and close it as quickly as possible in a try/catch/finally block. You dont hold onto it for the duration of the user's session. A book on JDBC should help clarify this.

  • Microsoft office access record-locking information

    Hello,
    Maybe is a stupid question but i didn't saw question similar to this and I'm concerned about my privacy. Yesterday when i logged in to my skype account I found out that in Users-App Data-Skype- there were created a small file called 'microsoft office access record-locking information'. I'm not exactly sure what this means, because it is happening for a first time. I'm not using Microsoft account for logging in into Skype, also I did not gave any access to another computers, especially to Skype folder.Also after logging off from Skype, this file is not automatically deleted. Can somebody explain me should I concern about something?

    CMMMC wrote:
    I dont know how to post my own question, but see that there is a response to this question within the last 8 mins.
    what my question is (and it must be ridiculasly simple but i cant find it) is how do i get to the page where i can make calls...where my contacts are and such...from the skype home page?  i am in prague, using skype from here...am logged into my account but it is just all of my account info, history and such.  there is no icon to make a call.  i have clicked on everything to see where the option is to simply make a call and...nothing...
    this happened before with my husband when he was using skype on windows 8 for the first time.  this computer has windows xp so it ought to be straight forward...not so far. 
    thanks,
    CMMMC
    It’s still straight forward but not using your Account page on web. You need to install Skype application on your computer and login to this application with your account details.
    http://www.skype.com/en/download-skype/
    See also this:
    https://support.skype.com/en/faq/FA11098/getting-s​tarted-with-skype-windows-desktop

  • Update query hangs due to a record lock

    Hi All,
    I am writing a Java application that uses JDBC to connect to an
    Oracle DB server.
    I'm trying to update a record locked from another transaction.
    Since I don't want to wait the termination of the other transaction, how can I recognize that the record is locked?
    Notice that I don't want to ask if the record is locked before my update is starting.
    Can I set the JDBC driver in order to raise an exception instead to leave the second transaction in a long waiting?
    Thanks

    You can try setting a timeout for the update. I have used this in Oracle with a PreparedStatement. It's simple to try out...
       ps.setQueryTimeout(45);  // set timeout to 45 seconds

Maybe you are looking for

  • ITune not working, upgrade failed

    I am unable to upgrade to iTune 11.1 on my Mac (OS X Lion 10.7.5)  The upgrade downloads and runs for a long time with and it hangs when it gets to "Running Package Scripts"    After a time it then throws the following error message:  The update "iTu

  • My cd/dvd drive not working properly will not read a recently burnt cd

    When i burn a cd it says that i have inserted a blank cd

  • Sudden strange message

    I'm running Photoshop CS3 on a 3.06 GHz Intel Core 2 Duo Imac with 4GB of memory. I am suddenly getting this message every time I try to save a change to an image: "Could not save (image name) because the file is already in use or was left open." I h

  • PO with account assgnmnet category "P"

    HI, I am tyring to create PO with acc.assgn category "P",i have entered WBS element .but the system is asking for G/L acount. On what basis we have to enter G/L account. I tried it by entering G/L account but not accepting. How to link G/L account to

  • Vendor return incase of Import Procurement

    In my case comapny procuring material of 10 kg from germany and out of that 2 kg are damaged comletely.Since we are not sending material back to vendor due to may be frieght cost. Plz suggest me how can i go for availing credit of excise duties where