Using a custom TableNameConverter

Hello there,

In the process of majorly refactoring a JIRA add-on, I am trying to figure out a way to use a certain table prefix for certain tables, and another one for others...  I've found some references to (activeobject's) TableNameConverter around, which seems to be the way to implement just that, but I'm struggling to find any info about how to actually inject my own TableNameConverter implementation inside the ActiveObjects/EntityManager object.  I am currently using a standard AO config. Do any of you know how to configure that (via atlassian-plugin.xml?, spring.xml?) or know another way of controlling the generated database table names prefixes?

Marc

3 answers

I do not believe there is supported way to inject your own TableNameConverter. Is it "must" to do? Maybe you can find other way around like adding suffixes to your entities.

What I'm doing is to split an add-on into two. The problem is that I have many entities that end up in an activeobjects config with a different namespace, thus creating a whole new set of tables. Since I have many users already using my add-on, I don't want them to lose their data. The only workaround I can think of right now is to use a massive, error-prone database upgrade task to move data to another set of tables. So if I had a way to simply tell activeobjects to use the old prefix for the entities I moved, then no migration would be required and it would simplify things dramatically...

Unfortunately, the Table annotation just allows you to control the last part of the generated table names, e.g. ITEM in AO_A1B2C3_ITEM. The part I would like to get a hook on is the generated prefix ("A1B2C3" in the example). I know there's a namespace attribute that let you use something else than the plugin's key that is used to generate this, but unfortunately in my case I have entities coming from two different add-ons, thus having different prefixes. Basically, what I would like would be to be able to set a namespace per entity, rather than for all entities at once.

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 Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

688 views 6 13
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