How to lock a row and release lock

Hello
There are two thread, they read the same row, I want to lock this row when the first thread read the record, after this thread commit its data, release the lock, the second thread can lock this record, also can commit its data. I also want to know how to release the lock. And these operations are in different Classes, e.g. in Class A first thread lock the record, in Class B second lock the record, and in Class C release the lock.
Note: these two thread will read this record at same time.
Thanks in advance.

TopLink provides to forms of locking, optimistic and pessimistic.
<p>
You are referring to pessimistic. You can use pessimistic locking in TopLink through the ReadObject/ReadAllQuery API acquireLocks(), or acquireLocksWithoutWaiting(), this will use a "Select ... for Update" in SQL. You must be in a transaction to lock a row in the database (UnitOfWork in TopLink), and you locks are released when you commit or rollback the transaction. If you are using JPA, TopLink supports a JPA query hint "toplink.pessimistic-lock"="Lock" to allow pessimistic locking.
<p>
You can also use optimistic locking. An optimistic lock does not prevent another user from reading the same row, but ensures that only one user will be able to commit changes to the row. Optimistic locking typically has the advantage of better concurrency, and does not have issues with deadlocks.
<p>---
<br>James Sutherland
<br>Oracle TopLink, EclipseLink
<br>Wiki: Java Persistence, EclipseLink

Similar Messages

  • How to add new row and update existing rows at a time form the upload file

    hi
    How to add new row and update existing rows at a time form the upload file
    example:ztable(existing table)
    bcent                      smh            nsmh         valid date
    0001112465      7.4                       26.06.2007
    0001112466      7.5                       26.06.2007
    000111801                      7.6                       26.06.2007
    1982                      7.8                       26.06.2007
    Flat file structure
    bcent                       nsmh         valid date
    0001112465     7.8     26.06.2007  ( update into above table in nsmh)
    0001112466     7.9     26.06.2007  ( update into above table in nsmh) 
    000111801                     7.6      26.06.2007 ( update into above table in nsmh
    1985                      11              26.06.2007   new row it should insert in table
    thanks,
    Sivagopal R

    Hi,
    First upload the file into an internal table. If you are using a file that is on application server. Use open dataset and close dataset.
    Then :
    Loop at it.
    *insert or modify as per your requirement.
    Endloop.
    Regards,
    Srilatha.

  • How can I preserve row and column addresses on multiple cells at once in Numbers?

    How can I preserve row and column addresses on multiple cells at once in Numbers 3.2.2? I do a lot of rearranging and sorting and want to reference cells in other sheets. After entering the formulas (example: '=Sheet1::Table 1::H126') I will sort the table and the formulas will not move with the sort.  I think I can fix this by going cell by cell checking the 'preserve row' and 'preserve column' boxes when editing the formula.  I want to avoid having to go one by one.  I know that checking the boxes creates a formula like this: '=Sheet1::Table 1::$H$126'  I have also tried entering this manually and filling down but it doesn't include the preservations (the $$) in the autofill.  If there is another way to remedy my sorting problem that would also be welcomed!
    THANKS!!

    The title of the post is this
    How can I preserve row and column addresses on multiple cells at once in Numbers?
    I restated the Question as follows
    Can "Preserve Row" an / or "Preserve Column" be set on multiple cells at the same time.
    In both cases it is not asked if multiple cells can be set to....
    That is a given.
    Step back a second...  It is like selecting multiple cells and setting the text color of the currently selected cells to red. This can be done. More than one cell at a time modified because they are currently selected.
    Whats is being asked is:  if more than one cell is selected at the same time can the settings "Preserve Row" an / or "Preserve Column" be applied. No table I put up will help with that question.
    YES or NO
    If YES how?

  • How to Increase the Rows and Columns Size of Bex Query in Enterprise Portal  of SAP  7.3

    Dear All,
    Please let me know the process how to Increase the Rows and Columns  Size of Bex Query in Enterprise Portal  of SAP  7.3 .
    Currently I am getting Only  4 columns and 10 rows in One Page .And I am getting 1,2 etc tabs for both row and column. So i want to increase the column length more than 100  and row length more than 10000.
    Please suggest me a suitable solution to over come this issue.
    Please find the Below screen shot.
    Thanks
    Regards,
    Sai

    Dear All,
    Please find the attached screen shot.
    The report be open with 4 or 5 columns and 5 or 6 rows.
    So, please  let me know how to increase the length of the table.
    Do the needful for me to over come this issue.
    Thanks
    Regards,
    Sai.

  • How can I make Numbers respect the row and column locks in an Excel workbook opened in Numbers???

    I have a Windows server app that generates Excel workbooks to be emailed to political campaign volunteers to be loaded into Numbers on an iPad, edited, then emailed back to be posted to the server database.  There are two problems encountered:
    1.  The Excel workbook has the first row (column headings) and first column (route identifier) of cells locked, so that they will not scroll off the screen, but Numbers doesn't respect the locks, so when the user scrolls horizontally or vertically, the column headings and/or the route identifier scroll off the screen.
    2.  The Excel workbook has pop-up "tool-tip" type comments in certain column headings in order to provide the user with the acceptable entries for those columns, but Numbers does not respect those.  When the user touches any of the commented column heading cells, a context menu appears instead of the comment.
    What must I do in the Excel workbook sheets, or what settings can be made in Numbers to correct the above?

    I imported a Numbers '09 file into Numbers on the iPad.  All comments were removed during import. Frozen header row and column were retained.
    Thank you for your responses I must ask, however, when you refer to "importing" the Excel file, are you referring to a two step process whereby the Excel file is first converted by some other process into Numbers format, then opened in the Numbers application - which is what I have to do in my PC application to generate the Excel file, and reverse that process to convert the Excel back into my database format - or are you simply referring to opening the file in Numbers as "importing" it?  And please excuse any ignorance, as I'm not at all familiar with Apple's terminologies.  In fact, I don't own an iPad myself, but rather I have to depend on one of my clients to do the testing for me.
    I imported an XLSX file into Numbers on the iPad.  The file used "freeze panes" to "freeze" the first column and row. Only warning on import was that it changed fonts. It imported without the first row and column frozen and with no comments. Nothing I can do about the missing comments but it was a simple matter to turn the first column & row into headers and freeze them.
    Unfortunately this would not be an efficient  solution, since the end users are, for the most part, elderly political campaign volunteers who are fairly computer illiterate.  These workbooks are actually canvassing lists - known as walklists.  Their purpose is for the volunteers to interview voters, record the results of the interviews, and post the results to a database, which provides the campaigns with valuable strategizing capabilities.  Also, these workbooks have multiple pages - as many as 10 or more.  and from what I infer from the above, the setting changes would have to be made on each page.
    My whole intent in developing this iPad/Tablet methodology was to significantly reduce volunteer's work - which is a recruitment benefit - and eliminate paper.  While the latter would be accomplished, the former would not, and in fact would tend to increase it.  It's necessary to keep the first row - column headings - and the first column - the route identifier - from scrolling off the page, so that the volunteer won't have to keep scrolling up and down and right and left to know what the data are.
    Conclusion: Comments are not supported on the iPad version of Numbers.  Frozen headers are not imported from Excel but can be recreated easily.
    I was previously directed to the Apple website  http://www.apple.com/ipad/from-the-app-store/apps-by-apple/numbers.html which extols the wonders of the Numbers application.  About halfway down the page there's a section regarding, "Sliders steppers and pop-ups".  The web page states that pop-ups can be set up but, being a marketing site, gives no indication whatsoever as to how it's done.  I was hoping someone could tell my if there's any way to carry them over from an Excel file.

  • How to get a row level share lock

    Is it possible to acquire a row-level share lock, which would do all of the following?
    1. Prevent others from updating that row.
    2. Allow others to read that row.
    3. Allow others to update other rows in the same table.
    I have the following scenario where two transactions need to lock eachother out:
    Set-up:
    Insert into TABLE_A(value_a) values ('ok');
    Insert into TABLE_B(value_b) values ('ok');
    Transaction A:
    Select value_b from TABLE_B
    If value_b = 'ok', update TABLE_A set value_a = 'not ok'
    Transaction B:
    Select value_a from TABLE_A
    If value_a = 'ok', update TABLE_B set value_b = 'not ok'
    If transaction A runs first then the end result is "not ok" only in TABLE_A.
    If transaction B runs first then the end result is "not ok" only in TABLE_B.
    If the two transactions run concurrently, it is possible to get "not ok" in both tables. This is what I would like to prevent.
    One way to get what I want is to use "select for update":
    Transaction A:
    Select value_a from TABLE_A for update
    Select value_b from TABLE_B for update
    If value_b = 'ok', update TABLE_A set value_a = 'not ok'
    Transaction B:
    Select value_a from TABLE_A for update
    Select value_b from TABLE_B for update
    If value_b = 'ok', update TABLE_B set value_a = 'not ok'
    This way both transactions won't perform their update unless they know that the result if their select will still be the same after they commit. However, by using "select for update" Transaction A has gained an exclusive lock on the TABLE_B row. If a Transaction C with the same contents as Transaction A happens concurrently, then the two will block eachother even though all they both want is to read data from the same table.
    Another way is to use "lock table", however using that would block out not only writes to a specific row, but writes to all rows in the table. (In my example there is only one row, but obviously that's just a simplified example.)
    I have looked at the "serializable" isolation level, but that doesn't seem to help because the queries and updates involve more than one table.
    I know that "reads don't block writes" is a fundamental part of the Oracle design that makes Oracle what it is, but is there any way I can explicitly make it happen anyway? Or can anyone see some other solution to what I'm trying to achieve?

    Let me give a more real-world example to show what I'm talking about.
    Imagine a simple bug-reporting OLTP application. Each bug has 3 fields:
    1. Description
    2. Resolution
    3. Status (open/closed)
    The application also has some rules:
    A. If the Status is "closed", Description and Resolution cannot be changed.
    B. In order to change the Status to "closed", both a Description and Resolution must be specified.
    Now as long as only one person at a time updates a bug, everything is fine. However, if one person switches the Status to "closed" while another concurrently blanks out the Resolution you end up with a closed bug that has no Resolution. This is why some locking is necessary.
    If Description, Resolution, and Status are all stored in the same table row, then it makes sense for each transaction to simply select the whole row FOR UPDATE, and then UPDATE it after it ensures all the rules are passed. However, in my fictional bug-reporting application they are all stored in separate tables. Now, the transaction that is making the change to Resolution could lock the row in the Status table FOR UPDATE (as everyone so far has suggested). Transactions making a similar change to the Description should then also lock the row in the Status table FOR UPDATE for the same reason. The end result of this is that Description changes and Resolution changes lock eachother out (can't happen concurrently, are serialized) when they don't need to be. Description changes and Resolution changes don't affect eachother, but because they both need to (exclusively) lock the same row, they are serialized.
    If there was a way to acquire a share lock on the row in the Status table, then Description and Resolution changes would use that and not affect eachother. Status changes would still acquire an exclusive lock on the row, and would be blocked by (and block any further) concurrent Description and Resolution changes. This would be ideal.

  • Function module to hold and release lock on MARD table entry

    Hi Gurus,
    Can you please tell me Function module to HOLD lock on MARD table and the Function Module to release lock on MARD table entry.
    Thanks and Regards,
    Sudipto

    Look via SE11 lock objects, use F4 for tables MAR*, the best for your request is on MARC table with object EMMARCS, so use FM ENQUEUE_EMMARCS and DEQUEUE_EMMARCS.
    Regards,
    Raymond

  • How do I get pass and icloud lock

    How do I get pass the icloud sin in

    hey guys im writing from the bahamas i have 2 iphones locked to icloud i bought the first 1 (iphone 4) a few months ago and after i bought it a few weeks later the previous owner locked the phone and i was unable to reach him. i was upset but i only spent $300 dollars on it so i got over it recently i bought an iphone 5 and the previous owner had an icloud account on it but i didnt notice until after i bought the phone i later on went ahead and updated the phone to 7.0.4 and now the phone is locked and i cant reach the previous owner,,please help me apple the phone is not stolen and ill do anyhing to prove its not

  • How to increase the row and Column length of Bex query in EP Portal 7.3

    Dear All,
    Please let me know the process  to Increase the Rows and Columns  Size of Bex Query in Enterprise Portal  of SAP  7.3 .
    Please  let settings to increase rows up 10000 and column 100 in one page.
    Thanks
    Regards,
    Sai

    Dear All,
    Please find the attached screen shot.
    The report be open with 4 or 5 columns and 5 or 6 rows.
    So, please  let me know how to increase the length of the table.
    Do the needful for me to over come this issue.
    Thanks
    Regards,
    Sai.

  • Error loading from csv - how to integrate valid rows and drop invalid?

    Hello,
    Log from execution (step: load csv data):
    ODI-1228: Task SrcSet0 (Loading) fails on the target ORACLE connection ODI_STAGE.
    Caused By: java.sql.BatchUpdateException: ORA-12899: wartość zbyt duża dla kolumny "ODI_STAGE"."C$_0URZADZENIA"."C1_ZWIAZKI" (obecna: 17, maksymalna: 6)
    So, it's clear. There are too long fields in csv, maximum is 6, current: 17. But, some rows are good (with ZWIAZKI lenght >=6). I need to load valid rows, integrate them, sent to destination table. Invalid rows should be isolated in external csv - it happens. But how can I integrate valid rows and prevent entire interface fail?

    I don't think something exists to really be prepared for every situation (invalid length, invalid format, ...).
    Here is an idea but it's not beautifull and I'm not sure it's the good way to do that :
    -First you should have a unique key (easier if it is on only one column).
    -Then Develop an new IKM to insert on a row-by-row insert/commit basis with an ORDER BY clause on the UK in the select. Before the insert step, the value of the UK for the current row should be stored in an ODI variable.
    -Create your interface and put a filter on your UK : UK_FIELD > :CURRENT_UK
    -Create a package, set CURRENT_UK to a value you know will be less than the possible min and refresh a new variable MAX_UK with a query to find the MAX(UK_FIELD). Then put your interface in the package and do a loop around it so it ends only when CURRENT_UK = MAX_UK. You should redirect both OK and KO arrows from the interface to the testing condition.
    @Phil : Sorry for "stealing" your reply :P. Nice to see you agree with me.

  • How can I print row and column headings?

    In AW6 I was able to select Appleworks in the print window and check if I wanted to print row and/or column headings. I have not been able to find how to do this in Numbers. Can anyone tell me how?
    Paco

    Paco wrote:
    I have not been able to find how to do this in Numbers.
    Perfectly logical, the feature is unavailable.
    Workaround:
    Use a row header and a column header to mimic the missing feature.
    In cell B1 I entered
    =CHAR(CODE("A")-1+COLUMN())
    and applied fill to the right
    CAUTION, this formula is OK only from colum B thru column Z.
    In cell A2 I entered
    =ROW()
    and applied Fill Down
    Then convert column A as header one
    convert row A as header one.
    Yvan KOENIG (from FRANCE dimanche 22 février 2009 12:28:34)

  • How to  make JTextArea rows and colums auto-increase?

    My test program is attached as below.
    The JTextArea can not enlarge itself when the text in a line is too long that some characters are hidden.When rows grows too many will also see the problem.
    How can I make the rows and columns auto-increase to meet the width or height of my text?
    -----My Test Demo----
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.color.*;
    import javax.swing.*;
    public class Test{
    public static void main(String[] args){
    JFrame f = new JFrame("My Editor");
    Container ct = f.getContentPane();
    JPanel jp = new JPanel();
    JTextArea ta = new JTextArea("My software.",10,30);
    JTextArea ta2 = new JTextArea("Hello,World!",10,30);
    jp.setPreferredSize(new Dimension(400,400));
    jp.setBackground(Color.green);
    jp.setLayout(null);
    jp.add(ta);
    ta.setBounds(100,100,150,200);
    ta.setOpaque(false);
    ta.setBorder(null);
    jp.add(ta2);
    ta2.setBounds(100,120,150,200);
    ta2.setOpaque(false);
    ta2.setBorder(null);
    // jp.addMouseListener(new MyMouseListener());
    ct.setLayout(new BorderLayout());
    ct.add(jp,BorderLayout.CENTER);
    f.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent evt) {
    System.exit(0);
    f.setVisible(true);
    f.pack();

    This link to the Java Swing tutorial will show you how to add the JTextArea to a JScrollPane:
    http://java.sun.com/docs/books/tutorial/uiswing/components/simpletext.html#textarea
    It appears to me that you are new to Swing so you should read the entire tutorial "Creating a GUI using JFC/Swing" before asking any more question. The tutorial can be read online or downloaded from:
    http://java.sun.com/docs/books/tutorial/
    The download link for all tutorials on this page is near the bottom.

  • How to stop "Add Row" and "Delete" from committing.

    Hello, I am new to Application Express, and maybe someone can help me make this save like an Oracle Form.
    If you hit the "Add Row" button, enter data, then hit the "Add Row" button again, it commits the first row. If you check a value and hit the "Delete" button, it commits the delete. I would like the insertions and deletes to be handled like an update, that is with an explicit commit by hitting the "Apply Changes" button.
    Can I control this in Application Express, and how?
    Thank you,

    Kevin,
    1. instead of having a form on a table, you would create a form on a collection,
    2. collection is also a table but it is only of a temporary nature - it is valid with the corresponding session. Once the session is closed, you can't access the collection.
    3. to see how to create a collection and a tabular form use this example:
    http://htmldb.oracle.com/pls/otn/f?p=31517:176
    4. add row and delete will add / delete a copy of your table data. You can then create a process to save the data in your target table only if the button apply changes is clicked.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to layout constraint rows and columns "right"?

    Hi.
    I have a complex constraint layout with 8 columns and 11 rows. Since this layout is not an MXML-file, I need to do it in actionscript. Is there a "best pratice" on how to layout this without the Design view in Flash Builder?
    Is it possible to display the columns and rows like in HTML, where I could say "border=1" or use css?
    Regards,
    Jo

    What makes you think that it is not there? Any form which doesn't have the same set of members across rows and dimensions are asymmetric.
    Asymmetric rows and columns contain different sets of members selected across the same dimensions
    Oracle Hyperion Planning, Fusion Edition Administrator's Guide
    I can add a column with only Q1 and then another column with Q2, Q3, Q4 which will make it an asymmetric form. Keep in mind not to check "Place selection in separate columns".
    Regards
    Celvin
    http://www.orahyplabs.com

  • How to preserve a row and column in numbers automatically.ie the cells are not consecutivecell a1 a3 etc

    working on a league table
    when sorting the league table ,I need to preserve the row and column
    I can preserve row and column by using the drop down menu on every cell,but would like to do it automatically(2 clicks to every cell)
    working in numbers
    yosemite 10.2

    This technique would be quite slow. Unfortunately, it's the only way I could think of if it's really an Excel file. If it's tab delimited file, you could read a whole thing into 2D array and work on Array instead of reading cell-by-cell.

Maybe you are looking for

  • Time Machine drive disappears when i reboot

    When i reboot my iMac, my USB-connected external Time Machine hard drive does not remount, and it is not visible in the Disk Utility program. The only way i can get it to remount is to power-cycle the external drive. Unplugging and re-plugging the US

  • Load Balancing on 837 router

    HI Prof, I've two cisco 837 router with cisco IOS 12.3 currently. I would like to configure load balancing on both the router, have tried to configure GLBP but it show me that the hardware not supported. Is there any other protocol or technology to a

  • Prepositioning files on a Server 2008 Cluster

    I recently replaced a Server 2003 cluster with a server 2008 cluster. After the migration my prepostioning stopped functioning. The virtual servers are named the same and all the credentials, etc are the same. If I go into one of the preposition defi

  • Youtube, Photo Stream not working, also watching a movie from apple or netflix  fault.

    Can anyone help, since I updated the latest software on my Apple TV, my youtube no longer works, it says unavailable, and i cant log in, it says I can log in with this account. also everytime i watch a movie on netflix or from apple, it freez or rest

  • Webservices: excluding some methods of EJB

    Hello, I am using WLS 8.1sp4 and currently generating the Webservices for our stateless session EJBs using servicegen and clientgen ant tasks. We have a requirement for not exposing certain methods of the EJBs as webservice operations. I couldn't fin