Port Jira connect plugin's database to server plugin

Dhara February 23, 2016

I am porting existing JIRA connect plugin to server architecture. In connect, i was using mysql database with jdbc connection.

1> Can i directly use connect's mysql database in server plugin?

 2> If not, then i am fine with Active Object too. But i am not getting exact detailed documentation on active objects. (How to create combo unique key, Joins between tables). 

2 answers

1 accepted

2 votes
Answer accepted
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2016

Server plugins should use Active Objects to store data - this is the recommended approach. If for some reason AO does not work for you you can always connect to other database, but this makes things a lot more complicated - for example:

  • You should bundle the appropriate JDBC connector
  • You need a UI for providing db connection settings - host, port, user, etc..
  • Who will create the database for your add-on ?
  • etc...

Here're some useful guides on Active Objects

https://developer.atlassian.com/docs/atlassian-platform-common-components/active-objects

https://developer.atlassian.com/docs/atlassian-platform-common-components/active-objects/getting-started-with-active-objects

And about the JOINS

https://developer.atlassian.com/docs/atlassian-platform-common-components/active-objects/developing-your-plugin-with-active-objects/the-active-objects-library/manytomany-relationship

https://developer.atlassian.com/docs/atlassian-platform-common-components/active-objects/developing-your-plugin-with-active-objects/the-active-objects-library/onetomany-relationship

 

Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2016
Dhara February 23, 2016

@Boris Georgiev Thanks Boris. Actually i checked all above links but not getting any good example for how to add combo unique key, On DELETE cascade on foreign key, add procedures and triggers in active objects.

 

Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2016
  • You can't create multi column keys - https://ecosystem.atlassian.net/browse/AO-96
  • AO does not support procedures and triggers - you might need to re-design your application and move this logic into the Java persistence layer
  • Also I don;t think there is a CASCADE delete, so you should also handle that in Java

 

Dhara February 23, 2016

@Boris Georgiev [Botron] : Thanks Boris. I think yes i need to do everything using JAVA now. sad  I wanted to reuse connect plugin code as much as i can in server plugin.

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 23, 2016

Yes, as long as it's not the JIRA database - you must never write to a JIRA database directly.

Dhara February 23, 2016

@Nic Brough [Adaptavist] SO active objects is the only option in server plugin for Database. Right?

 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 23, 2016

You can't use the database in Connect either, so I'm not sure what you're doing.  I'd assumed you were reading an external database and your addon will continue to do that.

 

Dhara February 23, 2016

@Nic Brough [Adaptavist] : yes you are right. In case of connect i am using external database. But in server plugin, i don't want to use external database. I want to port that external database in JIRA itself through active objects.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 23, 2016

Ah, good, I did understand it correctly then!  Thanks!  Boris has beaten me to all the links I'd recommend.

The only thing I'd add is that you should stop thinking about doing things at a database level (forget triggers and keys etc) - you need to use the functions for handling AO as documented in Boris' links.

Dhara February 23, 2016

@Nic Brough [Adaptavist] Thanks Nic. Its clear now.

Suggest an answer

Log in or Sign up to answer