Cloning the GeneratedValue for another column during insert

I have an entity for a MSSQL table with IDENTITY auto-generated primary key column. I want another column (int as well) to have the same value set during an insert.
How can I do this using JPA? It's my understanding that the @Id and @GeneratedValue(strategy=GenerationType.IDENTITY) annotations can only be assigned to a single getter method.
I tried using entityManager.createNativeQuery("SELECT IDENT_CURRENT('fooTable')").getResultList();but that doesn't return a resultset. Same problem if I use JDBC.

This a Seam app and I'm using Hibernate manual flush. So alternatively I could do an insert using persist() then flush() then update using merge() then flush() all in one method (one transaction using CMT).

Similar Messages

  • Modify the Data Load wizard to remove the check for unique columns

    Hi,
    I'm trying to make a Data Loading Wizard into my application, which basically works nice except for one thing:
    I want to remove the check for unique columns, and insert ALL data which the users wants to upload.
    (Like the Data load utility under development).
    The reason is, that the data I want to upload is an export from my bank statements (in XLS / CSV format)
    And these exports don't have any primary key.
    Using the Apex wizard created Data Upload pages, I will loose data in case I had two identical payments in a day.
    Is there a way to do this, while keeping the pages created by the wizard to make Data Loading pages?
    apex 4.2.1

    I would suggest to load the data into a view and process the records into the real table(s) with instead-of-triggers. When you add a "1=2" where clause to the view, there never is any data and everything will be loaded.
    Otherwise you have to have a "real" PK value, like a timestamp or a statement_nr+line_nr.

  • How can I get someone to answer the phone? I'm ready to give VERIZON my business. I sat on the phone for over 20 minutes only to be transferred to "Sales." I then sat on the phone for another 15 minutes!!!! I finally hung up.

    How can I get someone to answer the phone? I'm ready to give VERIZON my business. I sat on the phone for over 20 minutes only to be transferred to "Sales." I then sat on the phone for another 15 minutes!!!! I finally hung up.

    It takes an enormous amount of patience and time to get through to a qualified person.
    My Samsung S5 was locked out and needed a factory reset. Including attempts to achieve this locally, it took over an hour before my problem was even addressed.
    You may be interested in my journey to a very good technical support person.
    First I called the local sales person who had given me his personal business card with the friendly advice to call me with any questions. No answer at about 8:30 am when the business was open. His voice mailbox was full.
    Then I called the local store where I had purchased the phone. The person who answered the phone had learned all the proper stock phrases, but was not familiar with the issue, stated that there were no customers in the store, and I should go there in about an hour when there would be more staff. He suggested dialing *411 from my phone (which was locked). Then he gave me a number to call Verizon, which he had to look up, and it took a minute or so. The number was (removed). That is an internal number for employees and contractors and requires a code to access, obviously not designed for customers' use. He finally cut me off by stating that there were a number of customers in line waiting for his attention!
    After researching all my papers I found 800-922-0204 on my bill. The automated message suggested a hold time of 5 minutes, it took 20 minutes for a Customer Service Representative to pick up, and then I was referred to technical assistance. The hold time was announced to take 5 minutes, after 12 minutes I finally was connected.
    Fortunately I had my computer set up for Skype on a loudspeaker, and was able to do some other paperwork while waiting.
    Persistence was rewarded by having the good fortune to be connected to a very experienced, qualified and patient technical support staff with the name of Thomas (removed). He solved my problem, answered my questions during the process of resetting the phone, and gave an example of courteous and kind customer service that I had never experienced before when dealing with any major internet company.
    >> Edited to comply with the Verizon Wireless Terms of Service <<
    Edited by:  Verizon Moderator

  • Update one column while getting the value in another column

    Is it possible to in one single SQL statement update two columns in a table while at the same time obtaining the value of another column, on the same row, in the same table, and independently (that is, the update of the columns has nothing to do with the data that I want from another column)*?* Of course, I can do this in two operations, one being a "select" and the other one being an "update", but since I am in the same table and even on the same row, is it really necessary to make TWO database calls? That's why I want to combine the the two SQL-statements, for reasons of presumed effiency.

    jsun wrote:
    Is it possible to in one single SQL statement update two columns in a table while at the same time obtaining the value of another column, on the same row, in the same table, and independently (that is, the update of the columns has nothing to do with the data that I want from another column)*?* Of course, I can do this in two operations, one being a "select" and the other one being an "update", but since I am in the same table and even on the same row, is it really necessary to make TWO database calls? That's why I want to combine the the two SQL-statements, for reasons of presumed effiency.Two statements != two database calls.
    At least not in terms of SQL.
    JDBC requires a 'statement' but in SQL (depending on the data source) that can include multiple statements. An obvious example of this is a stored proc but there are other ways as well.

  • Getting error while creating form and report on webservice: ORA-20001: Unable to create form on table. ORA-02263: need to specify the datatype for this column.

    i am using the following description to create a web service reference:
    web reference :REST
    Name :Yahoo Map
    URL :http://local.yahooapis.com/MapsService/V1/mapImage
    HTTP Method: GET
    Basic Authentication: No
    Add Parameter:
    Name       Type
    appid        String
    location    String
    Output Format: XML
    XPath to Output Parameters : /Result
    Output Parameter:
    Name       Path       Type
    Url          /text()      String
    Then i tried to create form and report on webservice:
    Web Service Reference Type: Yahoo Map
    Operation: doREST
    All the fields i keep as default
    I tick the checkbox (url)in report Parameter
    After clicking next whereever required i click create button
    I get the following error
    ORA-20001: Unable to create form on table. ORA-02263: need to specify the datatype for this column.
    Please someone help to solve this as i need to fix it urgently.

    i exported the application from apex.oracle.com and imported it to our environment
    import went fine, but when I ran the IR page I got
    ORA-20001: get_dbms_sql_cursor error ORA-00904: : invalid identifier
    evidently the problem is a lack of public execute on DBMS_LOB, which is used in the generated IR source.
    while waiting for the DBA to grant privs on DBMS_LOB, changing the dbms_lob.getlength call to length() fixes the IR.
    however, i am not getting the download link on the associated form page... changed templates, that's not the issue -- we'll see if that's a dbms_lob issue as well

  • APEX:Getting error while creating form and report on webservice: ORA-20001: Unable to create form on table. ORA-02263: need to specify the datatype for this column.

    I am using Apex 4.2.2.00.11
    am using the following description to create a web service reference:
    web reference :REST
    Name :Yahoo Map
    URL :http://local.yahooapis.com/MapsService/V1/mapImage
    HTTP Method: GET
    Basic Authentication: No
    Add Parameter:
    Name       Type
    appid        String
    location    String
    Output Format: XML
    XPath to Output Parameters : /Result
    Output Parameter:
    Name       Path       Type
    Url          /text()      String
    Then i tried to create form and report on webservice:
    Web Service Reference Type: Yahoo Map
    Operation: doREST
    All the fields i keep as default
    I tick the checkbox (url)in report Parameter
    After clicking next whereever required i click create button
    I get the following error
    ORA-20001: Unable to create form on table. ORA-02263: need to specify the datatype for this column.
    Please someone help to solve this as i need to fix it urgently.

    336554,
    Looks like there is a 127-column limit on the number of report columns supported when using that wizard. Do you have more than that?
    57434

  • How to boldface the header for ONE column

    hi,
    I want to know how to boldface the header for ONE column. The following will boldface the header for all the columns in the table
    table.getTableHeader().setFont(new java.awt.Font("Dialog", 1, 12));
    Thanks.
    Jrabi

    jtable.getColumnModel().getColumn( indexOfBoldColumn ).setHeaderRenderer( TableCellRenderer aRenderer )

  • Showing contents of a column based on a condition for another column.

    Hello,
    I am trying to create a report that lists all of the Opportunities within our database. I need a few details about this opportunity to appear. I need the account name that this opportunity belongs to, amongst other things- which I can do, however I also need to show the number of UNITS for this opportunity BUT I have a condition that needs to be met before I show the number of units.
    I only want to show the UNITS IF the PRODUCTTYPE that this opportunity belongs to is "GA". Then I also need another column with UNITS in it, but again I only want the UNITS to appear if the PRODUCTTYPE IS DA.
    Essentially I am trying to find out the number of units per product type and I need these to appear in separate columns. If the PRODUCTTYPE doesn't meet the condition, i.e. the PRODUCTTYPE is not GA then I would like the field to be blank.
    I know that I should write this formula in the "Edit Formula" of the UNITS field, but I do not know how to write this condition.
    I would very much appreciate some help as soon as possible.
    Kind Regards,

    Hi,
    You need to use a case statement, it looks like this:
    CASE
    WHEN opportunity.producttype = 'GA'
    THEN opportunity.units
    ELSE NULL
    END
    Ofcourse you need to use the correct column names.
    Regards, Tim

  • For a book cover in Elements 9 I can't exchange the jpg for another. Can someone walk me thru it?

    At the upper rt. and wrapping around the book cover is a jpg. I want to exchange it for another, but can't. I've tried deleting the photo and then importing another. That won't work. Tried opening another layer, but that doesn't work either. Do I open a layer and then import? Whatever I do the jpg pastes onto the entire BACKground of the cover/canvas! Can someone walk me thru this?! Is the problem that I need to be in a certain format from the left column of icons?!
    Thank you!
    [email protected]
    Kristen

    Kristen
    From the nature of your question, it appears that you have posted in the wrong forum. This looks like a Photoshop Elements 9 (photo editing) question that you have posted in the Premiere Elements Forum (video editing).
    If this is as I suspect, please repost your question in the Adobe Photoshop Elements Forum or wait for a moderator to see your thread here and move your thread from here to there. It might be quicker for you to repost your question in the Adobe Photoshop Elements Forum.
    Photoshop Elements
    ATR

  • HT204053 How do I delete an account to use the emails for another?

    I would like to use my original iTunes password but created a new account when I set up this iPad. How can I use this for another account?

    You can use the same password on multiple accounts, you only need to make a new Apple ID, Take a look at this link, http://www.apple.com/support/appleid/

  • How to disable/enable the cells for editing column wise in JTable in java?

    Hi All,
    Can any one tell me how to disable the cells for editing by column wise in JTable?
    Here depending upon the radio button selected, I need 2 disable some columns for editing
    and enable some columns for editing?
    how can I do tat using JAVA?
    Any sample code is of great help to me.
    Thanks in Advance

    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    ~

  • SSRS Matrix not showing all the entry for a Column Groups

    I created a Matrix in my SSRS report and for some reason if the COLUMN GROUP has more than one
    entry it only shows the first one and not the second or consequent entries.
    I opened a question in SO and here is the link:
    http://stackoverflow.com/questions/23248421/how-to-add-column-in-a-ssrs-table-based-on-criteria
    All help is appreciated.

    Hi SiKni8,
    According to your description, you have a matrix report. If a user has more than one start date and end date, you want to put all those start dates and end dates into one single row for this user. Right?
    In Reporting Service, for all data fields textbox appearing at intersection of rows and columns, the matrix will use Sum aggregation function by default. If the data can’t be calculated by aggregation function, it will return the first one of records. This
    is the reason why you only get the first start date and end date for each user. In your scenario, it is impossible to append more columns at the end of the matrix without setting column group. And we can never append columns dynamically based on the numbers
    of the records. So for your requirement, we find a workaround which we think is the most related to the answer you want. We use custom code to get both StartDate and EndDate, then return them as string. After that we append those strings and put the whole
    string into a cell. Your case has been tested in our local environment. Here are steps and screenshots for your reference:
    Put the custom code below into your report:
    Dim Num As String = ""
    Dim tempstr As String = ""
    Function AggregateString(Title as String, StartDate as String, EndDate as String) 
    If Title = Num Then
       tempstr = tempstr + "(" +StartDate+" , "+EndDate+")  "
    Else
      tempstr=""
      Num = Title
      tempstr =tempstr+"("+StartDate+" , "+EndDate+")  "
    End If 
    Return tempStr 
    End Function
    In our sample report, we created a matrix based on your description. It looks like below:
    In textbox next to [Title], put the expression below into it:
    =runningvalue(Code.AggregateString(Fields!Title.Value,Fields!StartDate.Value,Fields!EndDate.Value),Last,"Title")
    Ps: In our report, we set the type of date as string when creating table and dataset. If your date type is different, use Cstr() function and convert it into string.
    Save and preview. The result looks like below:
    Reference:
    Matrices (Report Builder and SSRS)
    RunningValue Function (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • How to calc sum of one column, based on the condition of another column?

    I would like to create a formula that adds up the total cost from column F for each specified service in column D. For example, the result for PM (project management) would be $495. Any ideas?

    I think you could use this formula, using your cell references:
    =SUMIF(D4:D21,"=CM",F4:F21)
    Then, change the "=CM' to "=PM", etc. for each service.
    Like JaxJason, I can't test this in Numbers right now, but it works in Excel, and the functions are identical.
    SUMIF(test-range, "condition", [sum-range]):
    * test-range: A reference to the range of cells containing values to test. Must be the same dimensions as sum-range.
    * "condition": Any comparison statement that results in a logical TRUE or FALSE value.
    * sum-range: Optional; a reference to the range of cells containing the numbers to be added. Must have the same dimensions as test-range. If omitted, test-range is used.
    I hope this helps.
    - Michael
    Message was edited by: Apple fan Michael

  • How to name the data for each column I am acquiring in lvm file

    does anybody hint  How to name the data for each cloumn I am acquiring in lvm file.
    I want to tag or name ,eg temperature at top of a column which shows the temperature readings .I am writing into a labview measurement file.
    Thanks

    Use Set Waveform Attribute on each channel of your data.  Set an attribute with name "NI_ChannelName".  The value is a string containing the name you wish to call the channel.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • What triggers the prompt for memory test during boot up of WLC.

    I have a controller that sometimes does and sometimes doesn't prompt for memory test at boot up. What triggers the prompt for memory test at boot up?

    We have the same behaviour with a 4402 controller.
    After a software upgrade from 4.2.130.0 to 4.2.176.0 the controller didn't reboot automaticly during the first restart with the new software. I connected via console and saw this message:
    Airespace 4200 Wireless LAN Switch Board - Memory Test
    Invalid Option...Press any key to continue
    Airespace 4200 Wireless LAN Switch Board - Memory Test
    1. Restricted [4kB per MB]
    2. Entire Range [512M]
    3. EXIT
    Then I choosed option <3 Exit> and the controller started correct.
    Regards
    Hendrik

Maybe you are looking for

  • ITunes 7 is not opening!?Please Help!

    This new iTunes 7 is starting to really bug me. My problem is that everytime i try to open my iTunes the program opens for like 2 seconds then automatically closes. I've tried everything from repair in control panel and I even spent an hour on the ph

  • SQL that may be impossible to write

    I am currently using a 10.2.0.4 version Oracle Database. I have a table that contains all of the employees with a REPORTS_TO column so you can tell which employee reports to whom. The data looks something like this: POSITION_NBR EMP_NAME JOB_TITLE RE

  • WSDL Validation Failed (Web Services)

    I want to create a Web Service-Based Application in LabVIEW and I'm trying to go through the steps in the tutorial http://zone.ni.com/devzone/cda/tut/p/id/4728. I tried the following web services, but I always get the same error. http://coeservice.en

  • Transitions and other issues

    Hi all, I am a recent convert ... trying to say goodbuy to my windows box. In the windows world, I'm a Sony Vegas user ... great product. Its easy to use, give the ability to use multiple audio and video tracks, and so on. As my new mac is a MacBook

  • I can't access my email

    When i click on to get my email it doesn't go there and i get a passionup bar