on 11-13-2014 10:39 AM
Hi,
I have an ID (custom attribute, numeric, key) in my MDO object.
Also, have set a custom property last_insert_id which i want to use as value for ID in the next INSERT operation to be performed on the same MDO.
In short.. in my transaction, using MDO, i am trying to achieve the functionality similar to auto-increment concept in SQL tables.
Highly appreciate all your valuable inputs on the same.
Thanks,
Manisha
Also, I was wondering why custom properties for MDO object doesn't come up in the xml generated. For columns we can anyways get it as part of xml.
Any suggestions!!
Thanks,
Swaroop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swaroop,
Yes, we can see the custom properties' info when the MDO is queried with mode "Info", as is referred in following sample URL :
http://xxx.xxx.xxx.xxx:0000/XMII/Illuminator?server=MDOConnector&Mode=Info&MDO=BMG/MIIOBJ/EmployeeMDO&content-type=text/…
This answers, from where/how to extract the custom properties of an MDO object, in a transaction.
Now, it is to be discovered whether we can reset them with some other value.
Regards,
Manisha
Hi Manisha
I would second Swaroop's suggestion to read the ID and then increment it in the insert. However please understand that such an approach has severe drawbacks and also potential for failure.
For example assume 2 people execute the transaction in parallel and they simultaneously read the ID and then try to increment. One of them will surely end up with Primary Key Non Unique problem.
The way to avoid this would be to do a SELECT FOR UPDATE.
The best way to do this is not to use incremented ID as Key. Instead use GUID.
Regards
Partha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much for you replies, Swaroop/ Partha.
Yes, I could also think of the same approach and completely agree with the reason behind it.
But wanted to know if there is any direct way to implement it.
Also the main purpose of this query is to understand if we can consume/refer the MDO custom property in a transaction. And also, if it is possible to reset the custom property at the run-time.
Would be thankful, if somebody can provide some concrete info/link on this.
Regards,
Manisha
Hi Manisha,
As far as I know, custom properties cannot be referenced from MDO Queries, so you would not be able to make use of custom properties in MDO Insert query to simulate auto-seed.
For such a case, you can use combination of select and insert MDO queries in BLS. You can get max value of ID and add 1 to seed it.
P.S. You get custom properties in xml results.
Hope this helps.
Warm Regards,
Swaroop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.