Written by

Question P Patz · May 12, 2017

Use a class property to pass a flag

Looking for a way in which I could possibly pass a flag through a property when performing an Insert statement, on a mapped class.

insert into my.class (serialNumber, modelNumber, myFlag) value ('testSerial', 'testModel', 0)
    myFlag is not stored in the DB.

The mapped class then calls a legacy routine (MAC) via CodeMode = 'objectgenerator', (Insert method within the 'objectgenerator')

Within the legacy routine, I am setting an index... but I don't always want to set it (multiple inserts, and I will only set the index on the LAST insert)

How can I pass that flag through the insert call?  I attempted to make the property 'transient' and 'computed'.  But looking at the compiled code (INT), upon performing the Insert the value is nulled and the set, therefore wiping out whatever I passed in.

Is there anyway to do this?

Comments

Eduard Lebedyuk · May 13, 2017

Add on insert trigger. myFlag value should be available there.

0
Eduard Lebedyuk  May 15, 2017 to P Patz

Modify your objectgenerator method to get myFlag variable?

0
P Patz · May 15, 2017

I attempted that earlier, but the Trigger does not fire until 'before the save'. 

As I have a 'objectgenerator' my code and it is calling a legacy function, where the index is set.  As I step through the code, the legacy operations is performed and then the trigger is fired.  While I can 'see' the myFlag variable, within the trigger, the index has already been set.

0
P Patz  May 15, 2017 to Eduard Lebedyuk

That is the problem, I can't get myFlag to that method.

0