How are database tables named?
Let's take the example of an entity with class name
MyObject, belonging to a plugin with a key of
The table name for this entity will be AO_28BE2D_MY_OBJECT.
It has three parts:
AOis a prefix common to all Active Objects generated tables. It allows us to prevent collisions with existing product table names.
28BE2Dis the last 6 characters of the hexadecimal value of the MD5 hash of plugin key name,
com.atlassian.example.ao.myplugin, or if present, the
namespaceattribute on the
aomodule. This generated value helps prevent table name collisions between plugins that use Active Objects.
MY_OBJECTis the upper case translation of the entity class name
MyObject. The Active Object plugin chooses upper case to ease compatibility with multiple databases. This is not the default behavior of the Active Objects library so be wary about this when reading the Active Objects documentation.
You can also specify the table name you'd like to use through the
net.java.ao.schema.Table annotation. The value defined in the annotation will still be processed in the same way a class name would be processed. So if you set the value as
MyObject, the table will be named AO_28BE2D_MY_OBJECT.
Table names (once transformed) can not be more than 30 characters long. This is an Oracle restriction that is take in account whatever database one works with to provide consistency across all supported databases.