I'm moving data from one JIRA to another and I know about the sequence_value_item table that contains the next primary ids to use for each kind of table and its data.
I'm looking for something similar in Active Objects. For example when you add a new column to a board, the info is recorded in AO_60DB71_COLUMN. But how did AO know what primary key value to use - did it keep the last used value somewhere, or did it dynamically find the highest primary key for each table at startup?
I have added more info to https://developer.atlassian.com/jiradev/jira-platform/jira-architecture/database-schema#Databaseschema-ChangeHistory about this.
Basically, it's pretty easy in MySQL 5.6 since you can override autoincrement with an INSERT, but it's harder in Oracle 11g. With Oracle you have to disable a trigger, hack a sequence to increment it, reenable the trigger. Apparently Oracle 12 has autoincrement built in.
It is using DB feature for auto-increment keys
public interface Entity extends RawEntity<Integer> { @AutoIncrement @NotNull @PrimaryKey("ID") public int getID(); }
So, by default, all your entities are using this scheme
But simple google search shows that you can use some custom ones, as well
http://www.codecommit.com/blog/java/custom-primary-keys-with-activeobjects
However, I suggest to think twice, before using this approach and the main reason I see is that it can get pretty complex when you consider backup and restore functionality and your "custom functionality"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ActiveObjects uses the AUTOINCREMENT column attribute for the primary key (id) column in MySQL. In Oracle 11 it uses a sequence and a trigger to do the same thing
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
AO crates a new sequence when i create a table, can I use the existing sequence instead?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, it needs to be unarguably unique, so it uses autoincrement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
but I am using Oracle 11 it uses a sequence for same thing, Can you help me with how to use my custom sequence?
I have existing sequence "SEARCHACTIVITYID", I am creating the new table using AO where the primary key column should use this same sequence("SEARCHACTIVITYID") , how can i do this?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As SQL developer I can assume that usually every database provide next id. There are two major options: incremental and random id. It is commonly is configured into Database settings.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's not how JIRA does it. It stores the next id in the sequence_value_item table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Perhaps the id field once known is just autoincremented by the database?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.