How do I obtain the next number for a Primary Key using an ADF View Object?

I have two separate View Objects (A & B) for the same Entity Object. View Object A does a SELECT on all of the fields in the table. This View Object is where I execute my adds and updates. View Object B is only used to retrieve the next number for the primary key. This is done so that when I add a row to the database, I always get the max number of the primary key and add one to it. I accomplished this by setting the SQL mode to Expert and using the SQL: "SELECT MAX(NBR) AS MAX_NUMBER FROM TABLE_1". This may be overkill having a seperate View Object for this, but so far this is the only way I have found to obtain the next number. However, I have discovered that this way does not always work.
The problem I'm running into is when I try to add multiple records to View Object A without committing the transaction between each add. Because View Object B is disconnected from View Object A, the MAX_NUMBER of View Object B comes back with the same number for each add I do on View Object A. So I know I must retrieve the MAX_NUMBER from View Object A.
I've tried using the following code in my Table1ViewImpl class:
this.setQuery("SELECT MAX(Table1.NBR) AS MAX_NUMBER FROM TABLE_1 Table1");
this.executeQuery();
The view object now has what I want, but I have yet to figure a way to extract the MAX_NUMBER out of the View Object. I've also looked into using the method addDynamicAttribute() but I can't figure out any way to set the attribute with the MAX_NUMBER.
I can't be the only one trying to retrieve the next number from a database table using ADF. Can anyone help me with this? FYI - I'm using JDev 10.1.3 EA.

You missing the point.
On a multi-user db knowing the next highest number doesn't guarantee the number will be available when it comes time to commit the record. You can prove this to yourself by opening two instances of your app and do whatever you do to add a new record to your VO. Both will assume the same number, and when you commit an error will be generated
You must use sequences to avoid the possibility of duplicate keys. If you are trying to avoid gaps in your numbering then you need to convince yourself why this is necessary.

Similar Messages

  • How do i obtain the serial number for my CS6?

    I bought my CS6 Extended 12 months ago but I now need to find the serial number. I have the order number but that is all. Can anyone help?
    Thanks

    Go to Adobe's main site and log on. You should see your name and a "Manage Account" button. Click on that, and then "View All" under "Plans and Products". Then, under "Products", click on "View Other Products". Finally click on CS6, and you will see your serial number.

  • How can I change the default number for a contact when using Siri

    My husband has one mobile for work, one for home, both are in my favorites. When i'd ask Siri to dial his number, it would always ask me which one to use. Recently when calling him Siri asked if I would like to use his work number as the default and I mistakenly agreed. Now Siri never asks which number to dial and always dials the work number. How can I change that? I would like to make the default the home number.

    Thanks all for your responses.
    I tried to "order" Siri to change my husband's default number and whatever syntax I used for my request Siri responded with a web search on how to set favorites.
    So I ended up deleting the work number from my husband's contact information and I used Siri to call him a couple of times. After 24 hours (random time frame) I added his work mobile back to his contact information, but not in the favorites.
    SIri now dials his home number because it's the only one in the favorites.
    I'll add it to the favorites in due course.

  • Hi,  I lost my serial number for PS Elements11 following computer crash. Os is W7. I have the cd installation disc but there is no serial number with it or in the envelope  ..  How can I obtain the serial number please?     Thanks

    I lost my seriel number for PS Elements 11 following computer crash. Os is W7
    Peter Jones Aug 27, 2014 5:36 AM   
    Hi,
    I lost my serial number for PS Elements 11 following computer crash. Os is W7. I have the cd installation disc but there is no serial number with it or in the envelope
    How can I obtain the serial number please?
    Thanks

    If you registered the software you should be able to find the serial number thru your Adobe account online.
    To locate the serial number:
    http://helpx.adobe.com/x-productkb/global/find-serial-number.html

  • I lost my serial number for photoshop elements11 and premiere elements 11 combo.  how can I obtain a serial number for this program?

    I lost my serial number for photoshop elements11 and premiere elements 11 combo.  how can I obtain a serial number for this program?

    If you registered the software you should be able to find the serial number thru your Adobe account online.
    To locate the serial number:
    http://helpx.adobe.com/x-productkb/global/find-serial-number.html

  • How can I find the serial number for my creative suite CS6 I bought it from a store.

    How can I find the serial number for my creative suite CS6 I bought it from a store.

    https://www.adobe.com/account.html for serial numbers or subscriptions on your Adobe page... or
    Lost serial # http://helpx.adobe.com/x-productkb/global/find-serial-number.html

  • HT3965 how do i change the phone number for imessages?

    how do i change the phone number for imessages?
    i have set up an iTouch for my 10 year old son. To set up iMessaging between him and his parents i used my iTunes account but this picked up my phone number..........i now need to change this but cannot see how to do it in Settings. Any suggestions?

    Thanks, but i guess this means i have to create an email address for my son and hs own apple id?
    My aim is to link his mobile number to the iTouch but not to give him his own iTunes account....

  • How can I find the serial number for my stolen iPad that's associated with my apple ID ?

    How can I find the serial number for my stolen iPad that's associated with my apple ID ?

    If you registered it with Apple check your registered items at Your Support Profile for Registered Purchases. Also, see iOS- How to find the serial number, IMEI, MEID, CDN, and ICCID number.
    What To Do If Your iDevice Is Lost Or Stolen
    If you activated Find My Phone before it was lost or stolen, you can track it only if Wi-Fi is enabled on the device. What you cannot do is track your device using a serial number or other identifying number. You cannot expect Apple or anyone else to find your device for you. You cannot recover your loss unless you insure your device for such loss. It is not covered by your warranty.
    If your iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should have done in advance - before you lost it or it was stolen - and some things to do after the fact. Here are some suggestions:
    This link, Re: Help! I misplaced / lost my iPhone 5 today morning in delta Chelsea hotel downtown an I am not able to track it. Please help!, has some good advice regarding your options when your iDevice is lost or stolen.
      1. Reporting a lost or stolen Apple product
      2. Find my lost iPod Touch
      3. AT&T. Sprint, and Verizon can block stolen phones/tablets
      4. What-To-Do-When-Iphone-Is-Stolen
      5. What to do if your iOS device is lost or stolen
      6. 6 Ways to Track and Recover Your Lost/Stolen iPhone
      7. Find My iPhone
      8. Report Stolen iPad | Stolen Lost Found Online
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
      1. Find My iPhone
      2. Setup your iDevice on iCloud
      3. OS X Lion/Mountain Lion- About Find My Mac
      4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)

  • I recently subscribed to Acrobat XI after the trial expired but when I went to activate it I was asked for the serial number. I only have the order number on the invoice. How do I get the serial number for the trial software that is on my computer?

    I recently subscribed to Acrobat XI after the trial expired but when I went to activate it I was asked for the serial number. I only have the order number on the invoice. How do I get the serial number for the trial software that is on my computer?

    Please do not try to send attachments in mail responses to forum messages. Please return to the forum and click Reply. You can then use the CAMERA icon to add your pictures. Looking forward to seeing what is wrong with your license screens - the general advice is simply to sign in, and everything is done. Make sure you use the SAME Adobe ID that you used to purchase, and check your account details to be sure the subscription is active.

  • How can I get the serial number for Premiere 11?

    In october 2012 I´ve bought a bundle pack with Photoshop Elements 11 and Premiere 11. After a hard disk crash i was about to reinstall them both but my wife has trown the envelope in the garbage... = No Serial number available!!
    I´ve registered the serial number for Photoshop Element 11 on Adobe, but not the key for Premiere (they are on the same dvd).
    How can I get the serial number for Premiere 11?

    I do not think there is any way for anyone here to help you (we are just other users) so you are going to have to contact Adobe
    Forum for Download & Install & Setup problems
    http://forums.adobe.com/community/download_install_setup
    Chat http://www.adobe.com/support/download-install/supportinfo/
    -or http://www.adobe.com/support/chat/ivrchat.html
    And tell your wife to be more careful about throwing things away

  • How can I get the serial number for registration and instalation?

    Hello ,How can I get the serial number for registration and instalation?

    contact your local sales representative.
    You don't need a serial number to install LabVIEW.
    Registration is optional.
    Activation is needed after the evaluation period.
    Install it without number and it will work for a limited time (30days?) in evaluation mode, giving you plenty of time to decide if you want to buy it.
    Check the license manager to see the activation status of everything installed.
    LabVIEW Champion . Do more with less code and in less time .

  • How do I locate the serial number for my I-Pad?

    How do I locate the serial number for my i-pad?

    Its printing in tiny numbers on the back of your iPad,  in settings, general, about on the iPad,  on the box, in iTunes under account information.

  • How do i get the serial number for my phone if I do not have it?

    How do I get the serial number for my phone that has been stolen?

    From the box it came in.
    From iTunes if you backed it up to iTunes.
    From the receipt.
    From the retailer if they have those records.
    You can get the IMEI number from your carrier, which is linked to your serial number.

  • How do I calculate the Out_flags number for the PIPL?

    Hey everyone!
    I'm kinda new to After Effects programming, so I hope I'm not asking a too obvious question.
    I've searched the web and this forum but just couldn't find a working solution for this problem.
    Compiling my plug-in works properly, but as soon as I select it from the effects menu I'm presented with a mismatch error.
    My question (as already asked in the title): How do I calculate the correct number for the pipl global_out_flags?
    Thanks in advance,
    Markus

    You will probably get a faster answer here: After Effects SDK                        
    The link is on the home page of the AE forum

  • How can I change the phone number for messaging and FaceTime?

    How can I change the phone number for messaging and FaceTime?

    Unable to make or receive FaceTime calls after April 16, 2014
    http://support.apple.com/kb/TS5419
    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    iOS: FaceTime is 'Unable to verify email because it is in use'
    http://support.apple.com/kb/TS3510
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
    http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
    Set Up Alert Sounds
    http://www.quepublishing.com/articles/article.aspx?p=1873027&seqNum=3
    Extra FaceTime IDs
    http://tinyurl.com/k683gr4
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Troubleshooting iMessage Issues: Some Useful Tips You Should Try
    http://www.igeeksblog.com/troubleshooting-imessage-issues/
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Fix Can’t Sign Into FaceTime or iMessage iOS 7
    http://ipadtutr.com/fix-login-facetime-imessage-ios-7/
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    iOS 7 allows you to block phone numbers or e-mail addresses from contacting you via the Phone, FaceTime, or Messages
    http://howto.cnet.com/8301-11310_39-57602643-285/you-can-block-people-from-conta cting-you-on-ios-7/
    How to Block Someone on FaceTime
    http://www.ehow.com/how_10033185_block-someone-facetime.html
    My Facetime Doesn't Ring
    https://discussions.apple.com/message/19087457#19087457
    How to watch FaceTime calls on the big screen with Apple TV
    http://www.imore.com/daily-tip-ios-5-airplay-mirroring-facetime
    Send an iMessage as a Text Message Instead with a Quick Tap & Hold
    http://osxdaily.com/2012/11/18/send-imessage-as-text-message/
    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Text on the iPad
    http://ipad.about.com/od/ipad_tricks/a/How-To-Text-On-The-Ipad.htm
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    How to Receive SMS Messages on an iPad
    http://yourbusiness.azcentral.com/receive-sms-messages-ipad-16776.html
    Apps for Texting http://appadvice.com/appguides/show/apps-for-texting
    You can check the status of the FaceTime/iMessage servers at this link.
    http://www.apple.com/support/systemstatus/
     Cheers, Tom

Maybe you are looking for

  • Easiest way to downgrade from Apple TV v3.0.1 to v3.0 - please help!

    How do I downgrade from Apple TV v3.0.1 *_to v3.0_* ? Since, Boxee is only possible till v3.0

  • A question.. but little different...

    I want to know.. that... i wana know that is that possible .... actually i want to implment a software.... a software whcih can access other programm features... for example... via my software.. 1)i can open Calculator(calc.exe) 2)if i add 1 + 1 the

  • Ipod wont work in wall outlet?

    I have a Ipod 4 gen and it has stopped working plugged into the wall but works in the computer. I have tried the cords to see if they work and they work with others. What do I do?

  • If you switch your mac to pc can you play Pc games?

    I was curous, when you switch your mac with bootcamp, can you play games that play on the PC?

  • Control lesson re-entry behavior?

    I have a question that might be more LMS related, but I thought I'd post it on a Captivate forum since I am using Captivate to for the content end of my project. In a nutshell, my client wants to use a captivate lesson as both a lesson and as referen