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

This widget could not be displayed.

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.

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

578 views 25 15
Join discussion

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