Need help in Pessimistic locking

I am getting the Maiximum of primaryKey field using reportquery ..now i want to lock the object of the report query. i am doing as following
ExpressionBuilder exp=new ExpressionBuilder();
ReportQuery query=new ReportQuery();               
query.setReferenceClass(Abc.class);               
query.addAttribute("memberId",exp.get("memberId").maximum());
query.acquireLocksWithoutWaiting();          
Vector results = (Vector)uow.executeQuery(query);
System.out.println("results---->"+results);
now i increment the value of primary key as follows
ReportQueryResult result1=(ReportQueryResult)results.get(0);          
System.out.println("hello"+result1.getByIndex(0));
Integer ctr=(Integer)result1.getByIndex(0);
System.out.println("ctr:-"+ctr);
int count=ctr.intValue();
count=count+1;
System.out.println("incrementedValue:-"+count)
here i insert the new record to the database ;;
the whole code work fine but when i trying to implement the pessimistic locking by
     query.acquireLocksWithoutWaiting();     
it will gives the following error..Please help me ..thanks in Advance     
ServerSession(28523022)--Connection(27817788)--SELECT MAX(MemberId) FROM Abc FOR UPDATE OF * NOWAIT
Local Exception Stack:
Exception [TOPLINK-4002] (OracleAS TopLink - 10g (9.0.4.5) (Build 040930)): oracle.toplink.exceptions.DatabaseException
Exception Description: com.sybase.jdbc3.jdbc.SybSQLException: Incorrect syntax near '*'.
Internal Exception: com.sybase.jdbc3.jdbc.SybSQLException: Incorrect syntax near '*'.
Error Code: 102
     at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:227)
     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:698)
     at oracle.toplink.threetier.ServerSession.executeCall(ServerSession.java:506)
     at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:131)
     at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:115)
     at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelectCall(CallQueryMechanism.java:194)
     at oracle.toplink.internal.queryframework.CallQueryMechanism.selectAllRows(CallQueryMechanism.java:565)
     at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:733)
     at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectAllReportQueryRows(ExpressionQueryMechanism.java:694)
     at oracle.toplink.queryframework.ReportQuery.execute(ReportQuery.java:442)
     at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:493)
     at oracle.toplink.queryframework.ReadQuery.execute(ReadQuery.java:125)
     at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:1958)
     at oracle.toplink.threetier.ServerSession.internalExecuteQuery(ServerSession.java:629)
     at oracle.toplink.threetier.ClientSession.internalExecuteQuery(ClientSession.java:392)
     at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086)
     at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2189)
     at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086)
     at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1038)
     at com.pearson.Test.Test.insert(Test.java:664)
     at com.pearson.Test.Test.main(Test.java:78)
Caused by: com.sybase.jdbc3.jdbc.SybSQLException: Incorrect syntax near '*'.
     at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
     at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
     at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source)
     at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
     at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
     at com.sybase.jdbc3.jdbc.SybStatement.queryLoop(Unknown Source)
     at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(Unknown Source)
     at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeQuery(Unknown Source)
     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:802)
     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:651)
     ... 19 more

I will explain you what I am trying to do:- we want to allocate the primary key to each new inserted row. suppose there are more than one user who are trying to insert the record in the database on the click of save button..how we can handle this situation by allocating them unique Id to each row..how we can genrate unique primary key to all the users who are inserting the new rows.
Please help me how can i genrate unique primary key if more than one user inserting the data in the database. As you said use sequencing in toplink how can i use this?our database is sybase is it support Pessimistic locking or optimistic locking. need urgent help
thanks in advance

Similar Messages

  • HT201210 i need help restoring a locked ipod

    i need help restoring a locked ipod touch

    Connect to iTunes on the computer you usually Sync with and “ Restore “...
    http://support.apple.com/kb/HT1414
    If necessary Place the Device into Recovery mode...
    http://support.apple.com/kb/HT1808
    Note on Recovery Mode.
    You may need to try this More than Once...
    Be sure to Follow ALL the Steps...
    But... if the Device has been Modified... this will Not necessarily work.

  • I need help with a lock

    i have two methods
    synchronized parsedata(){}
    and
    synchronized savedata(){}
    they are synchronized because they use the same bufferedReader. However when a button on the gui is pressed i want parsedata to give up it's lock, but it never does. This only happens when i stop streaming data to the bufferedReader. If I keep streaming the data then the lock does release, however that isn't helpful, I need it to unlock when there is no more streaming data. Any help would be greatly appreciated. Thanx.

    Okay here is a short version of both methods
    in_data = new BufferedReader();
    synchronized public void parsedata()
    String newdata = in_data.readLine();
    StringTokenizer st = new StringTokenizernewdata, "=");
    command = st.nextToken();
    /* Decode received data */
    if((command.compareTo("DATA")) == 0)
    try
    for(int i = 0; i < block_size; i++)
    value1 = st.nextToken();
    //point count determines where we should be in the buffer
    if(data_value1 != point_count)
    for(int l = point_count; l < data_value1; l++)
    // Fill Buffer A for writing data to the output file.
    main_index_array[point_count] = -1;
    point_count++;
    } //end for
    } //end if
    /* Save data to InputDataBuffer */
    main_index_array[point_count] = data_value1;
    point_count++;
    elseif(command == "BUTTON")
    //do something else
    synchronized public void savedata()
    for(int i = 0; i < point_count; i++)
    if(main_index_array[i] == -1)
    String newdata = null;
    while(newdata == null)
    newdata = in_data.readLine(); // get some input
    try
    StringTokenizer st = new StringTokenizer(newdata, "=");
    command = st.nextToken();
    /* Decode received data */
    if((command.compareTo("DATA")) == 0)
    for(int j = 0; j < block_size; j++)
    value1 = st.nextToken();
    data_value1 = Integer.valueOf(value1).intValue();
    outfile.println("" + data_value1);
    } //end for
    i = i + block_size -1;
    } //end if
    } //end try
    catch(Exception io)
    textField1.setText("no data yet");
    } //end while
    } //end if
    else
    outfile.println("" + main_index_array);
    so as you can see i only try to read from the same bufferedReader if I am missing data. The problem I get is that the parsedata() routine seems to hang in the loop searching for data. If the parse recieves some command like button for example the parse finishes, releases the lock and goes on, however if it never recieves a command after the data has stopped streaming it doesn't release the lock. Thanx for your help

  • Flash Noob Need Help - Destination File locked??

    Ok so I got CS3 and I'm new at this, and I've made a movie,
    but if I save it, when I try to export it or preview it, it says
    "Be sure the destination file is not locked or on a locked drive.
    also check the file name is not too long." well the file name is 3
    letters so i'm assuming that it's the first thing. But i don't know
    what I did...can anyone help me? I'm running Mac OS 10.5.5

    Procyon wrote:
    1. So a file manager problem? What file manager?
    2. rsync -a --delete ~/music /mnt/mp3player
    the rsync command worked great!
    My file manager is Thunar

  • HT4211 Need help locating screen lock in multitasking bar on iphone

    Can someone tell mehow to locate screen lock in multitasking bar on iphone 4?

    http://support.apple.com/kb/ts3805

  • HT201269 i for got my pin to my iphone and now im loced out of my phone all it says thet i have to connet to ituen but i cant need help to un lock my iphone its a 4s

    i for got my pin to open my iphone and now im locked out but i remmber now but  it tells me to connct to ituens but i  cant please hlep me unlock my phone

    Follow this article if you have forgotten the passcode for the lock screen:
    iOS: Forgotten passcode or device disabled after entering wrong passcode
    If you have forgotten the PIN for the SIM card, read this one:
    iOS: Understanding the SIM PIN

  • [SOLVED] Need Help Remapping Caps Lock to Control

    So I've spent the better part of an hour trying to remap my caps lock key to control. I've added a udev policy "10-keymap.fdi" in /etc/hal/fdi/policy.
    <?xml version="1.0" encoding="ISO 8859-1"?>
    <deviceinfo version="0.2">
    <device>
    <match key="info.capabilities" contains="input.keys">
    <merge key="input.xkb.options" type="string">ctrl:nocaps</merge>
    </match>
    </device>
    </deviceinfo>
    I restarted hal and it seems to acknowledge my new rule. lshal | grep xkb yields:
    brian@brian-laptop:~$ lshal | grep xkb
    input.xkb.layout = 'us' (string)
    input.xkb.model = 'evdev' (string)
    input.xkb.options = 'ctrl:nocaps' (string)
    input.xkb.rules = 'base' (string)
    input.xkb.variant = '' (string)
    input.xkb.layout = 'us' (string)
    input.xkb.model = 'evdev' (string)
    input.xkb.options = 'ctrl:nocaps' (string)
    input.xkb.rules = 'base' (string)
    input.xkb.variant = '' (string)
    input.xkb.layout = 'us' (string)
    input.xkb.model = 'evdev' (string)
    input.xkb.options = 'ctrl:nocaps' (string)
    input.xkb.rules = 'base' (string)
    input.xkb.variant = '' (string)
    input.xkb.layout = 'us' (string)
    input.xkb.model = 'evdev' (string)
    input.xkb.options = 'ctrl:nocaps' (string)
    input.xkb.rules = 'base' (string)
    input.xkb.variant = '' (string)
    But when I hit the caps lock key, it still gives me caps lock, not control. xev unsurprisingly tells me the keysym I'm pressing is indeed caps lock. I know I could do this by using xmodmap but I'd like to keep my .xinitrc clean/would just like to know why this isn't working.
    Last edited by iamsmrt (2010-08-02 13:53:59)

    Anntoin wrote:
    Its worth trying adding this to your xorg.conf:
    Section "InputClass"
    Identifier "evdev keyboard catchall"
    MatchIsKeyboard "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    Option "XkbLayout" "gb"
    Option "XkbOptions" "ctrl:nocaps"
    EndSection
    I was having this problem for a while and this worked for me. Your mileage may vary.
    This worked, thanks!
    nixpunk wrote:
    iamsmrt wrote:I know I could do this by using xmodmap but I'd like to keep my .xinitrc clean/would just like to know why this isn't working.
    I use xmodmap and it's quite easy to setup.  Just curious, but why exactly do you want to keep your ".xinitrc clean"?
    My OCD more than anything

  • HT4061 i CANNOT READ THE SERIAL NUMBER, but I need help - icloud has locked up my email

    Yesterday tech support had me load iCloud onto my computer and now my Outlook won't work

    Marceta wrote:
    Yesterday tech support had me load iCloud onto my computer and now my Outlook won't work
    And how is this related to an iPhone or the inabliity to read the serial number?

  • Hi everybody.. i have a problem nad i need help a.s.a.p ... i forgut my ipad passcode and tryed to remember it tell it locked and i cant get open .. it says connect to itunes .. i did that and its still not opening? what can i do? thanks

    hi everybody.. i have a problem nad i need help a.s.a.p ... i forgut my ipad passcode and tryed to remember it tell it locked and i cant get open .. it says connect to itunes .. i did that and its still not opening? what can i do? thanks

    http://support.apple.com/kb/HT1808
    Regards.

  • Hello, I need help with my macbook pro. It looks like I cannot install anything anymore. Everytime I try to install a new software, use the migration assistant or click the lock to make changes, it simply does not react.

    Hello, I need help with my macbook pro.
    It looks like I cannot install anything anymore. Everytime I try to install a new software, I simply get stuck during the installation type process. I put in my password, it does accept it, but it does not go any further.
    I tried to reset the password, put no password, repair the permissions, the disk but nothing will do. I nearly got stuck with the log in screen but finally succeeded in disabling it.
    So I thought I might try to create a new account but I cannot click the lock to make changes. It simply refuses to react.
    I am now thinking about using the migration assistant to save all my settings, data and so fourth, but again I get stuck when I have to type in my password. It accepts it but nothing happens...
    I guess it has something to do with the authorization process, but can't find anything on the internet about it... Can you help me out?
    I am running Lion 10.7.3.
    Regards,
    Nicolas.
    (I apologize if any grammatical/structural mistakes were to be found, english is not my mother-tongue. )

    You probably won't like this suggestion, but I suggest you reinstall Lion.
    First, backup your system. Next, reboot your system, press/hold the COMMAND-R keys to boot into the Recovery HD. Select 'Reinstall Mac OS X'. If you purchased Lion as an upgrade to Snow Leopard, the reinstall process will install Lion 10.7.3. If your system came preinstalled with Lion, you might still get Lion 10.7.2. Both installs are a total install of the OS. None of your apps or data will be impacted. Just the OS.

  • My iPod touch 4 generation 32gb sometimes is really slow and when ever I get on a app it will shut it down. My lock botton is broken and I use the accesery botton to lock it. That being said I can't power down my iPod. I need help, I don't know what to do

    My iPod touch 4 generation 32gb sometimes is really slow.When ever my iPod is being slow and I get on an app the app will shut down. My lock botton is broken and I use the accesery botton to lock it. That being said I can't power down my iPod. I need help, I don't know what to do! Could you tell me how I can power down my iPod or how I can fix the slowness and the shutting down of the apps.

    - Periodically double click the home button and close all the apps in the recently used dock. Then power off and then back on the iPod. This frees up memory. The 4G only has 256 MB of memory.
    - Next, reset the iPod
    To reset the iPod without the hardware buttons,
      Reset network settings: Settings>General>Reset>Reset Network Settings. All your wifi and bluetooth preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected. You will have to rejoin wifi networks and repair BT devices
    Then you can try:
    - Restore from backup. See:                                                
    iOS: How to back up                                                                                     
      - Restore to factory settings/new iOS device.

  • HT201263 My ipod touch is locked in recovery mode and I need help

    The ipod is locked in recovery mode. Everytime I plug it into the computer iTunes pops up and says it has detected ipod in recovery mode and it must be restored before using it with itunes.
    After I go throught he extracting software and then it locks up in itunes saying its waiting for the ipod but it just sits there for hrs with no result.
    I need help please

    No. You have to restore. To allow the restore try the following:
    - A reset.
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Manually placing the iPod in Recovery Mode
    - Placing the iPod in DFU mode.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If you can't turn the iPod off, let the battery fully drain. After charging for at least an hour try the above again.
    - Try on another computer.
    - Make an appointment at the Genius Bar of an Apple store.

  • I forgotten my bit locker password and recovery key.i need help .................

    i lost my bit locker password and i lost recovery key,i need help ..please help ......such important things are there in my e drive....pls mail me [email address redacted]

    Unfortunately if you lose the password and the recovery key you are not able to decrypt and access the information, that is the sole purpose of BitLocker.
    Blogging about Windows for IT pros at
    www.theexperienceblog.com

  • My screen is completely white, i've tried holding lock and home buttons as seen on you tube something called 'white screen of death' its goes black (think it switches off) then back to the white screen need help fast please!

    my screen is completely white, i've tried holding lock and home buttons as seen on you tube something called 'white screen of death' its goes black (think it switches off) then back to the white screen need help fast please!

    If you have not done a factory reset on the device, I recommend doing a complete  factory reset.  
    Factory Reset  - Warning this will reset device back to original factory settings.
    This method will not erase any MDN/MIN information
    Turn off the phone 
    Press Power + Volume Up/Down at the same time and hold until display will show a triage android screen 
    Display will show: 
    Reboot system Now 
    Apply sdcard:update.zip 
    Wipe Data/Factory Reset 
    Wipe Cache Partition
    Use VOL Down key to scroll down to "Wipe Data/Factory Reset", press home icon to select option and wipe device. 
    Display shows "All user data will be wiped out", press VOLUME Up to continue or VOLUME Down to exit. 
    Press Volume Up 
    Press Home to select "Reset System Now" - device will reboot
    If the problem persist I recommend having a store technician take a look at the device.
    Copy and paste the link below into your browser's address bar for the store locator.  
    http://www.verizonwireless.com/b2c/storelocator/index.jsp

  • My address bar has https with a lock on it.... don't know what I did? to put this on...need help

    I was changing things on my computer and I am not a real wiz at this stuff.  My safari when I open it now shows https with a lock on it.  I need help on removing this and also my google is missing from the address bar.  Anyone know what I have done?

    Safari 6
    URL address bar and Google search bar are combined into one bar now.
    Apple calls it Smart Search Field.
    There is no more a separate Google search bar.
    https with lock icon means that information entered in the bar is encrypted for the purpose of security.
    For details:  http://support.apple.com/kb/PH11893

Maybe you are looking for

  • Exporting data from ALV Report...

    Dear All, While I am exporting data from ALV report to any other Format (Excel, Txt, HTML) it only export the data of last column, but the heading is comming properly and also the column heading is displaying properly. So how to rectify it. (the repo

  • Regarding spool generation

    Hi Friends:   kindly see the below program: *& Report  ZSM1                                                        * REPORT  zsm1                                    . TABLES : lfa1,zsm1. SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. S

  • LSMW Read Data shortdump

    Hi guys.. I'm currently testing out on LSMW I'm trying to create new material for transaction MM01. But when i click on Step 9: Read Data i get a shortdump What happened?     The current ABAP program had to be terminated becaus     ABAP processor det

  • [solved] confusion about vim and its config files

    Hi, Im getting really confused with vim and its /etc/vimrc config, and the per user ~/.vimrc. On one of my PC's I have an untouched /etc/vimrc and a /home/jason/.vimrc which has: syntax on now, on that same PC, if I run vim .vimrc "syntax on" in gree

  • HT1386 itunes iphone syncing issues

    itunes does not see iphone even when connected with usb cable. any help