The value of a property of a repository item can be another repository item. Both multi-valued properties and single-valued properties can have repository items as property values. This is a powerful feature, and allows you much greater flexibility in defining a database schema that your application accesses as a repository.

Consider as a simple example a repository that contains books and authors. You can represent both books and authors as repository items, which enables you to do things like this:

Repository gsa = ...;
String myBookId = ...;

// get my book from the db
RepositoryItem book = gsa.getItem(myBookId,descriptorName);

// get the author of my book (it's a dynamic bean too!)
RepositoryItem author = (RepositoryItem)book.getPropertyValue("author");

Without support for objects as properties, the application must get an authorId from the book and perform another lookup to get the actual author.

You can specify that a repository item property is another repository item, rather than a primitive, with the item-type attribute instead of the data-type attribute. The following example shows a portion of a template that defines two item descriptors, book and author. Repository items of the book item descriptor have an author property whose value is another repository item, an author. Repository items of the author item descriptor have a book property whose value is another repository item, a book.

<!-- The "book" item type -->
<item-descriptor name="book" default="true">
  <table name="book" type="primary" id-column-names="book_id">
    <property name="title"/>
    <property name="author" column-name="author_id"

<!-- The "author" item type -->
<item-descriptor name="author">
  <table name="author" id-column-names="author_id" type="primary">
    <property name="lastName"/>
    <property name="firstName"/>
  <table name="book" id-column-names="author_id" type="auxiliary">
    <property name="book" item-type="book" column-name="book_id"/>
loading table of contents...