This discussion is archived
4 Replies Latest reply: Feb 20, 2013 3:55 AM by 990534 RSS

CRUD opertaions on table

974835 Explorer
Currently Being Moderated
Hi

I have an edit form with read only table,
to edit the data, the user double click on a row in the table and a popup is opened with the current row data in edit mode.
also there is a button that on click open the popup in 'createInsert' mode.

I have 2 questions:
1. On click 'createInsert' the popup is opened but also a new row is added automatically to the read only table,
In case the user choose to cancel the new row, I have to refresh the table so the row will be deleted.
how could I clean up the new inserted row without refreshing the whole table?
(I was trying to use 'Create' instead of 'CreateInsert' but it makes another problems)
2. In the table there is user_id field and also user_modification_date, I would like that in case the user_id was changed and the new value is different from the old value,
on commit the user_modification_date will get the current date.
how could I implement it (without using a trigger)?

Thanks a lot
  • 1. Re: CRUD opertaions on table
    990534 Newbie
    Currently Being Moderated
    Hi,
    1)You can rollback the operation on the popupCanceledListener
    2)You can override doDml method in entity object impl class and on update insert the date into the corresponding field
    Any questions please let me know
    Thanks,
    Raj

    Edited by: RajaSekharReddy.M on Feb 19, 2013 7:27 AM
  • 2. Re: CRUD opertaions on table
    Suresh Karunarathne Guru
    Currently Being Moderated
    Hi,
    Hopes followings will useful
    1. On click 'createInsert' the popup is opened but also a new row is added automatically to the read only table,
    -->Use two VO instance in AM for same VO,One for CreateInsert and other for table
    how could I clean up the new inserted row without refreshing the whole table?-->You have to refresh the table

    how could I implement it (without using a trigger)? --> Use entity level history column feature(EO -->Double click on Attribute --> History column)
  • 3. Re: CRUD opertaions on table
    974835 Explorer
    Currently Being Moderated
    1) I'm doing rollback, but the row is removed only when I refresh the table.
    2) Could you give me an example?
    how to get the old value and compare it with the new value?

    Thanks a lot!
  • 4. Re: CRUD opertaions on table
    990534 Newbie
    Currently Being Moderated
    Hi,
    Please the mark the post as useful because it would help others also

    1)Yes you need to refresh the table have a partial trigger added to your managed bean code when you rollback.Why do you don't want to refresh the table is there any specific reason?
    2)use the code here to do your processing .

    +protected void doDML(int operation, TransactionEvent e) {+
    if (operation == DML_UPDATE)
    +{+
    +// you can implement you code here+
    +}+



    super.doDML(operation, e);

    +}+

    Thanks,
    Raj

    Edited by: RajaSekharReddy.M on Feb 20, 2013 3:55 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points