How to add classes to the XBRL Database model

From XBRLWiki
Jump to: navigation, search


The User Data Model is a set of Hibernate Entities defined outside the Reporting Standard XBRL and Database API that extends the data model in order to let the user add functionality that is not included in the original data model.

For example, the XBRL Database model contains XBRL Concept definitions in one table and XBRL Facts reported in instance documents defined in another table. If the user is interested in the average of all reported values for a specific concept definition there are two approaches: One is to query facts reported for a specific concept definition and then calculate the average value using a database formula, the other is to have that value already calculated and updated every time a new report is stored into the database and query directly that value.

The first approach (the dynamic approach) is good if the amount of information is low and there will be no high demand from the application perspective to execute a big amount of such queries. The second approach is much faster than the first one, but requires additional tables to store the accumulated value and the number of times the value has been reported.

The first approach does not require additional user defined classes. The second approach does.

Defining the user model

The user model is defined by providing two pieces of information. One piece is the class representing the content of a table record. The second piece of information is a file describing the "Serialization" strategy for that class. The first one we call the POJO class (Pure Old Java Object) and the second one is an .hbm.xml file according with Hibernate mapping definition language.

For more information visit

How the POJO and the mapping file are loaded

While creating an instance of the StorageService click here to see all details, the first parameter is an array of classes implementing the com.ihr.xbrl.manage.RegisterExtraClasses interface.

That interface is already implemented by the abstract class AbstractRegisterExtraClasses that only requires the user to override the getClasses method and return an array of POJO classes.

Read the documentation on the classes for more information about where to put the .hbm.xml files