3 Replies Latest reply: Feb 13, 2012 9:47 AM by Christian.Shay -Oracle RSS

    How to deal with sequences setting up ID fields via triggers in Lightswitch

    DarlaT
      In my database upon insert a trigger will fire which will set the ID field based on the sequence. I am new to Lightswitch and have set up my Entity Model just fine. So far it seems to be working okay. Except a problem occurs when I want to insert a new record, because the ID field is required the ID field automatically gets set to 0 which then is passed to the insert query which then bypasses the trigger and then fails because (at some point) there is already a record of ID zero in the database.

      I had hoped there was some way to edit the insert query removing the id parameter, but from what I understand that isn't possible.

      My other thought (which I will do for now) was to just generate the ID field within Lightswitch, but the problem I see with that is the Oracle Sequence will no longer be in sync.

      So does anyone know if there is some other means of handling this situation?

      Thanks in advance.