Creating Transactions

Mike Bray (Quote Loader Author)'s Avatar

Mike Bray (Quote Loader Author)

02 Jun, 2015 05:36 AM

When creating transaction I see that the Old ID is still being set on some transactions. The ones I have generated have -1 in the old ID. How is this set? Where does the next number come from? Can I depend on it for sorting?


  1. Support Staff 1 Posted by Sean Reilly on 02 Jun, 2015 02:52 PM

    Sean Reilly's Avatar

    The old IDs are deprecated and shouldn't be used anymore. However, if you'd like to make sure that something is there you can do something like passing System.currentTimeMillis() to get something that *should* be unique but not necessarily.

    The problem with the old IDs is that they can't ever be guaranteed unique now that syncing is a built-in function.


  2. 2 Posted by Mike Bray (Quot... on 03 Jun, 2015 06:18 AM

    Mike Bray (Quote Loader Author)'s Avatar

    Thanks Sean
    I would need all transactions to have a unique number so I will drop it.

    What is the best way to sort transactions so they are in entered sequence?


  3. Support Staff 3 Posted by Sean Reilly on 03 Jun, 2015 03:29 PM

    Sean Reilly's Avatar

    I would recommend using the TxnUtil.DATE_ENTERED_COMPARATOR to sort the transactions. That can be used in java collections or in the TxnSet.sortWithComparator(...) method, but only in relatively recent builds. I think that API is clean enough that it's worth bumping the requirements to a recent build.

    Also, FYI, I'm going to be pushing the current preview of MD2015.4 out as a stable release either today or tomorrow (hopefully), so targeting that build number will probably get a good number of users pretty quickly.


    Sean Reilly
    Developer, The Infinite Kind

  4. Mike Bray (Quote Loader Author) closed this discussion on 06 Jun, 2015 04:02 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

29 May, 2024 07:01 AM
29 May, 2024 06:26 AM
29 May, 2024 12:43 AM
28 May, 2024 11:59 PM
28 May, 2024 11:10 PM