JPA - How can I use the table's default Date types? e.g. CURRENT_TIME

Once again, can't find an answer anwhere.
I would like to know if/how one can use the default date/time/datetime types as declared for the target table when attempting to persist an entity having these fields set as null.
create table item
     item_id INTEGER NOT NULL PRIMARY KEY DEFAULT AUTOINCREMENT,
     date_created DATETIME NOT NULL DEFAULT NOW(*),
     date_updated DATETIME NOT NULL DEFAULT NOW(*),
);Now how can I get the above table to work when attempting to em.persist(myItem) whereby dateCreated and dateUpdated are both null?

I should also mention that TopLink has always supported the ability to retrieve the current time from the database for use in optimistic locking. The TimestampLockingPolicy offers the ability to configure the next value being retrieved from the database instead of using the local time from the JVM. Our extended optimistic locking configuration does not currently support setting this option but it could be done using a descriptor customizer which can be configured in your persistence unit properties.
Using optimistic locking may be a good solution for the last modified date since it will also ensure that you do not corrupt the database if someone else has incremented this value since your last read.
Doug

Similar Messages

  • How can we use the table partitions feature and.........

    Hai friends when i tried to use the bitmap indexes and table partitions feature ,
    I got a message like this
    'table partiotion feature not enabled'
    so please tell me how can i enable those features so that i will be able to use those features..........

    Partitioning and Bitmap Indexes are features of Oracle Enterprise addition. In fact, I think that Partitioning is an extra option that needs to purchased with Oracle Enterprise - it is not a default feature.
    These features do not exist on Oracle Standard Edition (and likely Express Edition too).

  • How can i use the nested table in form 6i

    how can i use the nested table in the form 6i
    ( i.e i want to insert record into the nestred table field ).
    bye siddharth singh

    Nested tables are not supported in Forms 6i, only simple object tables.

  • HT3354 how can i use one table for reference to another

    how can i use a table for a referance to another eg when i type a word in a cell, i will like it to match the word with another table then return the information in the cell i am using

    you can use vlookup() (or any of the lookup family of functions) to locate an item based on a key value:
    Here is an example of something you can do with two tables:
    The table on the right is title "Data" and stores a list of names with age and favorite color.
    The table on the left uses the value in the first column to lookup up information in the table Data
    in the table on the left:
    B2=IFERROR(A2&" is " & VLOOKUP(A2, Data :: A:D, 2, 0)&" years old and likes the color "& VLOOKUP(A2, Data :: A:D, 3, 0), "NOT FOUND")
    I know this look complicated.  so I'll break it up into smalled pieces:
    first the "&" is called the concatenate operator and joins two strings.  like this:
    a string is a set of characters between double quotes.
    so "string 1" & "string 2" becomes "string 1string2"  or "Sam " & "Jones" becomes "Sam Jones"
    you can use cell references instead of strings directly in which case the concatenation is performed on the contents of the cells.
    so if cell A1 contains "Hi " and the cell A2 contains "There"  then A1 & A2 will result in "Hi There"
    so you could add the formula
    A3=A1 & A2
    this is short hand for select cell A3 then type everything including the A3 so that A3 contains "=A1 & A2" (omit the double quote)
    OK.  So the formula I provided concatenates several items together:
    it concatenates A2, then the string " is " then a formula, then the string " years old and likes the color " then a formula
    the two formulas (highlighted in blue) perform a lookup of the value in cell A2 in columns A thru D of the table named "Data".  If if finds the value in cell A2 in the first column of the lookup range in the table Data (column A) then it returns the value from the same row but in the second or third column.
    all that is in a function calld iserror() to trap the condition where the calue you enter in A2 does not exist in the table Data:
    You will find the Numbers users guide and function reference helpful.  You can download then from Apple here:
    http://support.apple.com/manuals/#productivitysoftware

  • How Can I obtain the tables of one schema and the record size???

    How Can I obtain the tables of one schema and the record size???
    Example:
    TableName Record Size
    Tabla1 12500
    Tabla2 7800
    Tabla3 2046

    This is not an OWB question, but you can obtain bda-type information on tables by using the system view dba_tables.
    Regards:
    Igor

  • How can I use the field "Sales Order" on derivation?

    Dear All.
    This is about PA characteristic derivation.
    I want to change the characteristic value "Sales Order (KAUFN)" by derivation.
    But I cannot select the characteristic field on target field.
    The field "Sales order(KAUFN)" doesn't exist there.
    Why? How can I use the field "Sales Order" on derivation?
    Y.C.Bae

    Hi Bae,
    in order to be able to choose fields KAUFN (for sales order) and KDPOS
    (for sales order item) as target fields of derivation step 'enhancement'
    you have to modify the coding of subroutine EXIT  GET_ALLOWED_TARGETS
    in program RKEDRCOPA like this:
        NAME-IDENTIFIER = 'CO-PA'.
        NAME-TABNAME = FIELDTAB_ENTRY-TABNAME.
        NAME-FIELDNAME = FIELDTAB_ENTRY-FIELDNAME.
        IF FIELDTAB_ENTRY-USGFL CA 'DUV'
    BEGIN OF INSERTION *****
             OR FIELDTAB_ENTRY-FIELDNAME = 'KAUFN'
             OR FIELDTAB_ENTRY-FIELDNAME = 'KDPOS'
    END   OF INSERTION *****
             OR FIELDTAB_ENTRY-FIELDNAME = 'KNDNR'
             OR FIELDTAB_ENTRY-FIELDNAME = 'ARTNR'
    Actually sales order number and sales order item shouldn't be changed
    by derivation (therefore they are no valid target fields in standard)
    but if you need to fill them within an enhancement this modification
    will help you to define them as valid target fields. But this is just
    the technical frame so far; the logic from which table you'd like to
    derive the sales order number correctly depends on your implementation
    of the enhancement! I just want to ask you to be rather careful with
    the implementation of the exit so that the sales order number isn't
    changed in cases that shouldn't be concerned.
    Regards,
    Abhisek

  • How can utilize/use  the extended space in system.img ?

    Hello Guru's
    In Oracle VM , How can utilize/use the extended space in system.img ?
    a) Increased the system.img size using the following command:
    # dd if=/dev/zero bs=1M count=12960 >> /OVS/running_pool/18_test1/System.img
    b) Verified the added size of system.img file at OVS server.
    # ls -lh System.img
    -rw-r--r-- 1 root root 19G Feb 9 20:58 System.img
    c) Started GVM and additional size/memory is not shown ?
    # df -m
    Filesystem 1M-blocks Used Available Use% Mounted on
    /dev/xvda2 3984 2292 1652 59% /
    /dev/xvda1 92 12 75 14% /boot
    tmpfs 512 0 512 0% /dev/shm
    + Tried working with resizefs , resize2fs , cmd did not work.
    (GVM is created using Oracle provided template)
    + am i missing anything ?
    Oracle VM Setup Detail:
    oracle-logos-4.9.17-7ovs
    enterprise-linux-ovs-5-0.17
    ovs-release-2.2-0.17
    ovs-utils-1.0-33
    kernel-ovs-2.6.18-128.2.1.4.9.el5
    ovs-agent-2.3-29
    Thanks in advance for your help.
    Best Regards
    Basu

    I am not positive what you did is going to work, but it seems like you did the equivalent of imaging a small disk on a bigger disk. In that case, the first thing to do is update the partition table with fdisk. Start with fdisk -l in the vm for general information about the disk. Hopefully, the additional space will show. Then, work with fdisk to use the extra space. The easiest is to add a partition, then a file system on it. It is also possible to expand the last partition (you might have to delete it first), then expand what is on it (may be RAID, LVM, or the file system), layer by layer. As usual with fdisk, you run the risk of thrashing it all, so you may want to practice on a copy first. Obviously, the extra space can only be added to the last partition of the small disk.
    If the situation is more complex, you may have to boot a VM with both the small disk and the big disk at the same time. If you boot the VM off of an iso DVD image, you can then shell out, then run fdisk to partition the big disk the way you want, then use dd to copy the partitions you want in the order you want from the small disk. I am pretty sure not all combinations will work, but you get the idea. You can then take the small disk out, and boot off of the big disk.
    Come to think of it, you might just be better off with adding more space as a second virtual disk. You would then be free to partition/format it the way you want without messing with the first disk. Linux is so good with disk management, so many options.
    As a general statement, though, I like to put some distance between the high level file systems and the low level disk partitions, so I use LVM (Logical Volume Manager).
    Best of luck, keep us posted.

  • How can i extend the table control while transfering the data

    hi
    how can i extend the table control while transfering the data.

    Hi,
    For table control we have to handle the page down (P+, or what ever function codes are assigned to that activity) activity with our coding.
    Just check out this code:
    This is the bdc to update the XK01 transaction code (Vendor Creation).
    Here we will use table controls for bankings. Here Iam sending the coding and text files.
    Coding
    REPORT zprataptable2
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    DATA : BEGIN OF itab OCCURS 0,
    i1 TYPE i,
    lifnr LIKE rf02k-lifnr,
    bukrs LIKE rf02k-bukrs,
    ekorg LIKE rf02k-ekorg,
    ktokk LIKE rf02k-ktokk,
    anred LIKE lfa1-anred,
    name1 LIKE lfa1-name1,
    sortl LIKE lfa1-sortl,
    land1 LIKE lfa1-land1,
    akont LIKE lfb1-akont,
    fdgrv LIKE lfb1-fdgrv,
    waers LIKE lfm1-waers,
    END OF itab.
    DATA : BEGIN OF jtab OCCURS 0,
    j1 TYPE i,
    banks LIKE lfbk-banks,
    bankl LIKE lfbk-bankl,
    bankn LIKE lfbk-bankn,
    END OF jtab.
    DATA : cnt(4) TYPE n.
    DATA : fdt(20) TYPE c.
    DATA : c TYPE i.
    INCLUDE bdcrecx1.
    START-OF-SELECTION.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\first1.txt'
    filetype = 'DAT'
    TABLES
    data_tab = itab.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\second.txt'
    filetype = 'DAT'
    TABLES
    data_tab = jtab.
    LOOP AT itab.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-KTOKK'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'RF02K-LIFNR'
    itab-lifnr.
    PERFORM bdc_field USING 'RF02K-BUKRS'
    itab-bukrs.
    PERFORM bdc_field USING 'RF02K-EKORG'
    itab-ekorg.
    PERFORM bdc_field USING 'RF02K-KTOKK'
    itab-ktokk.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-LAND1'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFA1-ANRED'
    itab-anred.
    PERFORM bdc_field USING 'LFA1-NAME1'
    itab-name1.
    PERFORM bdc_field USING 'LFA1-SORTL'
    itab-sortl.
    PERFORM bdc_field USING 'LFA1-LAND1'
    itab-land1.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-KUNNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    cnt = 0.
    LOOP AT jtab WHERE j1 = itab-i1.
    cnt = cnt + 1.
    CONCATENATE 'LFBK-BANKS(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-banks.
    CONCATENATE 'LFBK-BANKL(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankl.
    CONCATENATE 'LFBK-BANKN(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankn.
    IF cnt = 5.
    cnt = 0.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=P+'.  " Page down activity
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(02)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    ENDIF.
    ENDLOOP.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-FDGRV'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFB1-AKONT'
    itab-akont.
    PERFORM bdc_field USING 'LFB1-FDGRV'
    itab-fdgrv.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-ZTERM'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB5-MAHNA'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFM1-WAERS'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFM1-WAERS'
    itab-waers.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-LIFNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=YES'.
    PERFORM bdc_transaction USING 'XK01'.
    ENDLOOP.
    PERFORM close_group.
    **Flat files for the above code***
    Intial screen data file.
    1 63190 0001 0001 0001 mr bal188 b in 31000 a1 inr
    2 63191 0001 0001 0001 mr bal189 b in 31000 a1 inr
    Table control Data:
    1 in sb 11000
    1 in sb 12000
    1 in sb 13000
    1 in sb 14000
    1 in sb 15000
    1 in sb 16000
    1 in sb 17000
    1 in sb 18000
    1 in sb 19000
    1 in sb 20000
    1 in sb 21000
    1 in sb 22000
    2 in sb 21000
    2 in sb 22000
    Regards,
    Kumar.

  • How can i know the table fragments

    Hi
    How can i know the table is fragmented.
    Thank you

    If you're in 10g you could try use the Segment Advisor to identify various issues etc with your table. This will also provide recommendations on how to improve things.
    (below script shamelessly stolen from the brilliant Oracle Base website)
    -- segment_adv_table.sql
    -- Use Segment Advisor to analyse a table.
    -- Original Version
    -- http://www.oracle-base.com/articles/10g/SpaceObjectTransactionManagement10g.php
    -- owner is SCOTT
    -- table is EMP
    -- do a search/replace to change these 2 values and re-run it ;)
    DECLARE
    l_object_id NUMBER;
    BEGIN
    -- Create a segment advisor task for the SCOTT.EMP table.
    DBMS_ADVISOR.create_task (
    advisor_name => 'Segment Advisor',
    task_name => 'EMP_SEGMENT_ADVISOR',
    task_desc => 'Segment Advisor For EMP');
    DBMS_ADVISOR.create_object (
    task_name => 'EMP_SEGMENT_ADVISOR',
    object_type => 'TABLE',
    attr1 => 'SCOTT',
    attr2 => 'EMP',
    attr3 => NULL,
    attr4 => 'null',
    attr5 => NULL,
    object_id => l_object_id);
    DBMS_ADVISOR.set_task_parameter (
    task_name => 'EMP_SEGMENT_ADVISOR',
    parameter => 'RECOMMEND_ALL',
    value => 'TRUE');
    DBMS_ADVISOR.execute_task(task_name => 'EMP_SEGMENT_ADVISOR');
    END;
    -- Display the findings.
    SET LINESIZE 250
    COLUMN task_name FORMAT A20
    COLUMN object_type FORMAT A20
    COLUMN schema FORMAT A20
    COLUMN object_name FORMAT A30
    COLUMN object_name FORMAT A30
    COLUMN message FORMAT A40
    COLUMN more_info FORMAT A40
    SELECT f.task_name,
    f.impact,
    o.type AS object_type,
    o.attr1 AS schema,
    o.attr2 AS object_name,
    f.message,
    f.more_info
    FROM dba_advisor_findings f
    JOIN dba_advisor_objects o ON f.object_id = o.object_id AND f.task_name = o.task_name
    WHERE f.task_name IN ('EMP_SEGMENT_ADVISOR', 'USERS_SEGMENT_ADVISOR')
    ORDER BY f.task_name, f.impact DESC;

  • How can I find the table of

    How can I find the table of the structure fields?
    A structures table?
    for example the table of sap standard structure diaprd or diadrp, I do not remember now?
    Thanks.

    The hard way....
    Go to SE11
    Enter the structure
    Position the cursor on the field
    Press Where-Used List
    Check all related table to see which one fulfill your needs
    Greetings,
    Blag.

  • How can I use the old Apple TV with new iTunes?  It tells me to input a code in iTunes but iTunes no longer has a spot to input this code to allow sync.  I can access the iTunes Store fine, just none of my Library

    How can I use the old Apple TV with new iTunes?  It tells me to input a code in iTunes but iTunes no longer has a spot to input this code to allow sync.  I can access the iTunes Store fine, just none of my Library

    read this
    https://discussions.apple.com/message/20429789#20429789

  • How can I use the print module to print different size images on one large "canvas"?

    How can I use the print module to print different size images on one large "canvas"? An example would be in Photoshop, go to file>new, and create the size paper I want, and move images of different sizes onto it.
    I was thinking the print module would do this automatically for me.

    You can't, at present. It's been a requested feature, so we'll see if it shows up in a future version, but it's not there at present.

  • How can I use the QR codes with my iPad 2. do I need to download first an app ?

    How can I use the/read the QR codes with my iPad 2 ? Do I need to download an app ?

    Yes.  There are quite a few available for free in the app store

  • I have an Apple MacBook Pro with 2 USB ports and a MiniDisplay Port. I also have an HDTV with a HDMI port. How can I use the TV as a display without any tethering wires between my computer and the TV?

    I have an Apple MacBook Pro with 2 USB ports and a MiniDisplay Port. I also have an HDTV with a HDMI port. How can I use the TV as a display without any tethering wires between my computer and the TV? I have a MiniDisplay Port to VGA adapter, but there are two issues with it: The new display doesn't have a VGA port, and even if it did, I wouldn't want to have my mac constantly attached to the display by a cable. I was looking for a way to use the TV as a display without any wires. Is there some type of bluetooth setup I could use? Please let me know if you have any suggestions.

    As I wrote above, I think you should look into the Apple TV yourself. The best place to find information about what it can and can't do and to ask your own specific questions is probably in the Apple TV forum, here:
    https://discussions.apple.com/community/appletv/appletv

  • HT4314 I have a game under one account, now I have an Itunes card under a different account, how can I use the $$$ in the card for the game I'm playing, I need to purchase different items for my game.

    I have been playing a game for a while under an account, now I have an Itunes card under a different account and would like to use that $$$ to purchase items for my game, but it doesn't let me because the game was downloaded under the original account. How can I use the $$$ in my new account?

    same here but i cant purchase a movie or anything

Maybe you are looking for

  • Why is the GROUP BY clause not working in my Query?

    Dear All, Below is the Query for a Summary Debtors Aged Analysis. The GROUP BY clause does not seem to be working. The Query returns all the unpaid invoices, instead of a single total row for each Customer. If a Customer X has 10 unpaid invoices, 10

  • ITunes 8 and Vista 64 bit - Is it WORKING?

    I'm reading all over the place that iTunes 8 is causing the "Blue Screen of Death" crash on Vista 32 bit PC's. Has anyone yet tried it on Vista 64 bit and been successful? I have a iPhone 3G and an iPod Classic 160GB - I only mention that because the

  • Change sort order in line graph

    Sorry, my mistake ! In one of the ColLabels i had placed the xsl:sort line ABOVE the xsl:for-each. So, now it is working. In a line graph I need to change the sort order of the elements in my XML file. I need the elements to be sorted by month number

  • 10g R1 to 10g R2

    Hi. I have successfully installed 10g R1. I want to install 10g R2 so that I can install OWB. Is there an up grade path to take? I tried installing 10g R2 about two monthes ago but had problems, generally around networks: ie I was asked to install MS

  • LMS 4.2 - can I make a default dashboard per individual user?

    I have created a very restrictive role to allow a team of helpdesk people to access Ciscoview read-only. Because of the restrictive nature of their role, the current default dashboard shows errors in every window - which is to be expected. I want to