How to get generated sequence number from JPA/TopLink

Hi there,
I am using JDev 10.1.3.3 with JPA + POJO + TopLink.
In the entity (POJO), I declared a sequence generated for a number field.
@Id
@GeneratedValue(strategy=SEQUENCE, generator="GEN_CUSTOMER_ID_SEQ")
@SequenceGenerator(name="GEN_CUSTOMER_ID_SEQ", sequenceName="CUSTOMER_ID_SEQ", allocationSize=1)
@Column(name="CUSTOMER_ID", nullable = false, precision = 12 )
private Long customerId;
In my program, I don't need to set the Id field because it is set automatically.
However, I want to get the generated sequence using code. Is there a way?
Thanks,
Jim
P.S. I cannot use getCustomerId because the value has not been set yet.

If you call persist on the new Entity, or flush() the id will be assigned, and you can get it.
There is also an API on the TopLink / EclipseLink Session getNextSequenceNumberValue(), that you can use to get a sequence value.
-- James: http://www.eclipselink.org

Similar Messages

  • How to get payment document number from paid column in monthly invoice

    Dear experts
    I use SBO japan version and i need to know how to get payment document number from paid column in monthly invoice ?
    in table MIN1, only contain invoice and credit note document number, there is no payment document number
    thank you for your help
    Best Regards
    JeiMing

    Dear Gordon
    Yeah, you are right, i can use field MIentry in RCT2
    thank you
    Best regards
    jeiming

  • How to get Accounting document number from billing document number

    Hi,
    How to get Accounting document number from billing document number i.e. from VBAK- VBELN.
    Cheta Pant

    Hi,
    VBAK is the Sale Order header table, Billing document table is VBRK.
    Sales tables (VBAK,VBAP,VBRP,VBRK) do not store accounting document numbers.
    You do other way around. Just go to SE16 and enter the Billing document number in field Billing document VBELN in BSEG or BSID or BSAD table and execute, you will find the accounting document number.
    If you just want collect this information once then you can use table BSEG, but if you think to develope a report then use table BSID and BSAD.
    Regards,
    Chintan Joshi

  • How to get purchase order number from delivery number?

    hi all,
    how to get purchase order number and item if i have only delivery.
    and in same way how to get po number and item if i know only batch number.
    kindly give me some solution i need this urgently.
    thanks in advance.

    Check the logic below:
    * Selecting the Sales Documents from VBFA for corresponding Invoice
        SELECT vbelv
                     posnv
          FROM vbfa
          INTO TABLE gt_itab3
         WHERE vbeln EQ gt_itab5-vbeln
           AND posnn EQ gt_itab5-posnr
           AND vbtyp_n EQ 'J'.
        IF sy-subrc EQ zero.
          SORT gt_itab3 BY vbelv posnv.
        ENDIF.
      ENDIF.
      IF NOT gt_itab3 IS INITIAL.
    * Selecting the Purchase Orders from VBFA for corresponding Sales Documents
        SELECT vbeln
               posnn
          FROM vbfa
          INTO TABLE gt_itab4
       FOR ALL ENTRIES IN gt_itab3
         WHERE vbelv EQ gt_itab3-vbelv
           AND posnv EQ gt_itab3-posnv
           AND vbtyp_n EQ 'V'.
        IF sy-subrc EQ 0.
          SORT gt_itab4 BY vbeln posnn.
        ENDIF.
      ENDIF.
    Batch number will be there in delivery item.
    Regards
    Kannaiah

  • How to Create a Sequence Number from BI Publisher Layout editor?

    How to Create a Sequence Number (1,2,3,4,......,etc) from BI Publisher Layout editor

    Thank you for your replay, but <?position()?> we can used it in template builder only not from BI layout editor
    I found a solution in this case we can used the following query.
    SELECT
    ROW_NUMBER() OVER(order by item_status) as Row,

  • How to get Shopping cart number from TECH_INFO Guid approval offline

    Hi,
    When a user approves a shopping cart via e-mail (offline approval), then in transaction SOIN we can the mail which is like this:
    TECH_INFO_A=00F3D1395134D34D34D37DFBE75E81512DB5DB5FBE&submit_a=Approve by e-mail&TECH_INFO_R=444244093D34D34D34DF7EF9D7A0544B6D76D7&NOTM_OUT=&EOM=1
    How can I retrieve shopping cart number from these guids ?
    Thank you very much.
    Regards,
    Peggy

    Hello,
    E-mail data extraction is done by method EMAIL_DATA_EXTRACT from class /SAPSRM/CL_OFFLINEAPP_INBOUND.
    With the exporting parameter EV_WIID, call function BBP_PDH_WFL_OBJECT_WI_GET: you will get the Shopping Cart number.
    To have an idea of the whole mail data extraction process, check report /SAPSRM/OFFLINEAPPROVALGET
    Regards.
    Laurent.

  • How to get Cost Center number from a Customer

    Hi Sap Experts,
    I have a customer number from xd03. But I would like to know which is the cost center used by this customer, how can I find that?
    Because I'm getting an warning message when using FB08, it points to the Tax Jurisdiction issue. I believe at some point, it's checking the Jurisdiction field of the cost center.
    Regards,
    CHL

    Hi,
    Thank you for the reply.
    The thing is, when I run FB08 for a specific document, i'm getting this warning Msg: Account assignment object has jurisdiction code XX, line iten XX AAAAAA.
    I checked already the configurations for jurisdiction code in customer master data and the path "define tax jurisdiction code" with spro.
    I noticed something, during the debug at some point its reading the cost center's jurisdiction number, and will compare it with customer's master data jurisdiction.
    But if there's no cost center it will process fine.
    It's in the program SAPLKAIP, form CostCenter_Check. Not sure if it's SAP standard code.
    Cheers.
    CHL

  • How to get a decimal number from three single byte numbers

    i'am in a difficult situation. I have motor which provides me the number of steps moved as three numbers of length one byte.I 'am attaching the program with this message. Here the commands from index 2-4 outputs will provide the number of steps moved. But these are numbers with a single byte length(<256). So how can I get the corresponding decimal number from these three single byte length numbers. please reply
    Attachments:
    stop2.vi ‏11 KB

    Without knowing what motor you are using, I'm guessing that you probably need to use the Join Numbers to combine the bytes into a U32.  The other option is to use the Type Cast function.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to get Purch.Ord. number from trans. /Nmir5 once you have Inv.Doc.nr.

    Does anyone knows how to get in a program PurchaseOrder number from transaction /Nmir5 once you have Inv.Doc.nr.(Invoice nr)
    I was looking for tables having data element RE_BELNR but did not found a suitable table(maybe more tables are included)
    Thank you in advance . I will be glad to award solution

    Hi
    Use the<b> RSEG</b> table which stores the Invoice doc No BELNR and FIscal year GJAHR, PO and Item EBELN and EBELP
    pass them and Take the EBELN and EBELP fields from it
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • How to get the Personal Number from Address Number

    Hi,
    I have one requirement which is as follows.
    I have one Customer. I am fetching Address Number(ADRNR) of this customer number from table KNA1.
    I want to find the Personal number linked to this Address number and Customer.
    Is there is any table or FM from where i will get the Personal number of the Customer using Customer number and Address number?
    Kindly Help

    Hi Sachin,
    Check this FM BUP_PARTNER_PERSNUMBER_GET
    " Check KNB1 and the Field name is PERNR, Most of the times this is not maintianed.
    " This refers to the Employees who are assigned as Customers
    " In XD03 go to the Company Code Data there you can find this Value
    " For more info contact your Functional Consultant
    " This is to the Best of my knowledge
    Also Check KNB1 but000 Tables
    Cheerz
    Ram

  • How to get the BP number from OBJECT ID or ID rel.Object taken from HRP1001

    Hi Gurus
    I am trying to find the BP number from the OBJECT ID or ID rel.Object which i got from the table HRP1001 in CRM  but i am not able to find the link straightaway to get that details
    Kindly help me to find out the table where i can simply put the OBJECT ID or ID rel.Object to get the BP number for ROLE EMPLOYEE
    Thanks a lot
    Regards
    Soni

    Hi Soni,
    I found this in a different thread:
    first you get the all connected partners to a position by selecting SOBID from hrp1001 (with OTYPE / OBJID of position, RELAT = 008, SCLAS = CP).
    With this SOBID go again to HRP1001 and fill the SOBID into OBJID (with OTYPE = CP, SCLAS = BP) and the SOBID of the result is the connected partner number.
    You can also use FM 'CRM_CENTRALPERSON_GET' instead of the last SELECT-Statement. Here IV_PERSON_ID = SOBID (of first select). You get the partner guid and can get data of the partner from but000.
    In this thread:
    Help needed...Infotype HRP1001--Getting details OF Position Users...
    Hope it helps.
    regards,
    Wim

  • How to get MM Invoice number from FI Accounting document number

    Hi,
    I am writing a query (OPEN ITEMS FOR ACCOUNT PAYABLE)through SQVI. We need to display MM Invoice number from FI Accounting document number . Please let me know the table name from where I can join FI document number and can retreive MM Invoice number.
    Thanks
    Rama

    hi,
    use this.
      SELECT belnr
               awkey
               INTO TABLE it_bkpf
               FROM bkpf
               FOR ALL ENTRIES IN it_mkpf
               WHERE awkey = it_mkpf-awkey.

  • How to get sd major number from my driver

    Hi,
    I have a specific question. I have a driver (mydriver) that acts like a filter driver.
    When it receives IO from the file system through strategy() routine, it wants
    to replace its b_edev with that of sd device instance. mydriver creates minor
    nodes exactly as sd driver. All I need is to know what is the major number
    of sd driver. How do I do this programmatically through mydriver?
    Your help is greatly appreciated.
    Thanks,
    sudhakar

    Hi,
    I am trying to develop a "filter driver" at the file system level for Solaris to get the statistics of some of I/O calls send to a SCSI device. It exists between the VFS and the file-system-dependent layer. Does anyone has experience in developing such a "pseudo file system module". Please share your experience and suggestions.
    Initially I was thinking to develop this by getting the "st" major number. That is the reason it is been posted as a reply to this query.
    Thanks in advance
    -Jiji

  • How to get a Random number from a list

    Dear Experts,
    I have a list in which I have 24 employee number, and from this I have to select 4 employees number Randomly,
    So please suggest how can I achieve this.
    Warm Regards
    Upendra Agrawal

    Hello
    do 4 times.
    CALL FUNCTION 'QF05_RANDOM_INTEGER'
         EXPORTING RAN_INT_MAX = 24
                   RAN_INT_MIN = 1
         IMPORTING RAN_INT     = ind.
    read table itab index ind.
    " do anything here
    enddo.

  • How to get the sequence value from the database

    Hi
    I created one sequence in the database.
    Then I want to take the current value or nextvalue of the sequence in a java program.
    How can i do this?
    can anybody please explain me?
    Thank you so much.

    Here you go ...
    Connection conn = null;
    PreparedStatement prepStmt = null;
    ResultSet rs  = null;
    int seqNo = 0;
    try {
         conn = dbConn.getConnection(); //manage your connection here
         String strSQL = "SELECT SEQ_NAME.NEXTVAL FROM DUAL";
         prepStmt = conn.prepareStatement(strSQL);
         rs = prepStmt.executeQuery();
         if(rs.next())
              seqNo = rs.getInt(1);
    catch (SQLException e)
    ...-Rohit

Maybe you are looking for

  • Interactive Report, Image display on download.

    hi all I have an interactive report with an image column displayed with a case statement (below) CASE WHEN APP.RENEWAL_DATE < SYSDATE THEN <--img src="#IMAGE_PREFIX#FNDCANCE.gif"--> WHEN APP.RENEWAL_DATE > SYSDATE THEN <--img src="#IMAGE_PREFIX#Fndok

  • How do I set cache to always reload a page?

    I am in an online class and need to set cache to always reload a page. I do not even know what a cache is. I have just downloaded Firefox 18.

  • FTP delays answering zOS client

    I have a Solaris 9 FTP server serving zOS jobs Sometimes, the FTP client outputs the messages: Connecting to: solaris9.ftp.server xxx.xxx.xxx.xxx port: 21. Connection to server interrupted or timed out. Server not responding, closing connection. FTP

  • OSX 7 Photoshop 4, migration problems with 150:30 error

    Luckily my recently deceased MacBookPro (2008) was fully backed-up on "TimeMachine".  Good move! Yesterday I purchased a new machine, with OSX 7 pre-installed, and used "Migration Assistant" to transfer my "Time Machine" saved data to this new machin

  • Price List error

    Dear Experts, When i am clicking on Issue for production then below error is coming.. i am not able to do Issue for Production.. Is this error occurred Because of Posting Period ???? Please help. Thank in advance, Santosh.