One of the most common questions when adding new functionality to JIRA is “where do I store my plugin’s data?”. The brute-force way is to add new tables or new columns to the database by modifying the file entitydefs/entitymodel.xml, but then all your future upgrades will need to make the same changes.
Two better approaches to storing your data are covered in this
chapter. The first one is to use the same
PropertySet interface that JIRA uses for much of
its own configuration data. The second approach is to use the newer Active
Objects plugin, which can handle both more complex data and more of it.
This Atlassian plugin is shipped as part of JIRA 5.0 and later, but can also be
installed separately in JIRA 4.3 and 4.4.
The first approach is to store plugin data where JIRA stores this
kind of configuration data, which is in the
propertyentry table. This also has the advantage
of allowing us to use the same classes, such as
PropertyUtils, that JIRA uses for accessing the
data. However it is strictly key/value pairs with no idea of relational concepts.
The way that JIRA uses the
propertyentry database table is based on the
PropertySet interface from
OpenSymphony. This interface allows you to store unique
“key=value” pairs with various
methods for different types of data.
propertyentry table is
defined in the entitymodel.xml file,
as shown in Example 6-1. Note that the entity name