How does Active Objects know the next primary key value?

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?

5 answers

1 accepted

0 vote

I have added more info to 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>
	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

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"

0 vote

Perhaps the id field once known is just autoincremented by the database?

0 vote
Vasiliy Zverev Community Champion Dec 28, 2015

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.

That's not how JIRA does it. It stores the next id in the sequence_value_item table.

0 vote

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

AO crates a new sequence when i create a table, can I use the existing sequence instead?

No, it needs to be unarguably unique, so it uses autoincrement.

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? 



Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jun 14, 2018 in Jira Service Desk

How the Telegram Integration for Jira helps Sergey's team take their support efficiency to the bank

...+ reading Fantasy). The same is true for him at the bank he works for: Efficiency is key when time literally equals money. Read on to learn how Sergey makes most of the time he has by...

421 views 2 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you