In order to keep a hierarchical directory structure, define a folder item type named book_folder:

<item-descriptor name="book_folder"
  <table name="book_folder" id-column-name="id" type="primary">
          <property name="parentFolder" item-type="book_folder"/>
          <property name="folderPath" data-type="big string"/>

This item type is specified to be a folder with the attribute folder="true". The folder-id-property attribute in the item-descriptor tag indicates that this item stores its parent folder ID in the database with a property named parentFolder.

The book and the book_folder item types store their paths in the database with the content-path-property attribute. The content-path-property attribute indicates the property of this item that defines the absolute path name of this item in the folder hierarchy. In this example, the path is stored in the property named folderPath. If the example has especially deep hierarchies, resulting in excessively long path names, it might instead store just the name of this item with the content-name-property attribute, and have the repository calculate the item’s absolute path by determining its parent folders, with the property indicated by the folder-id-property attribute.