Class SimpleModel

  extended by
      extended by

public class SimpleModel
extends Model

Database model that stores each node (transparently) and its properties (opaquely) in a single row. Large property values are stored separately and can be shared between nodes.

The set of tables used in this model includes:

Subgraph queries

This database model contains two tables that are used in an efficient mechanism to find all of the nodes in the subgraph below a certain node. This process starts by creating a record for the subgraph query, and then proceeds by executing a join to find all the children of the top-level node, and inserting them into the database (in a working area associated with the subgraph query). Then, another join finds all the children of those children and inserts them into the same working area. This continues until the maximum depth has been reached, or until there are no more children (whichever comes first). All of the nodes in the subgraph are then represented by records in the working area, and can be used to quickly and efficient work with the subgraph nodes. When finished, the mechanism deletes the records in the working area associated with the subgraph query.

This subgraph query mechanism is extremely efficient, performing one join/insert statement per level of the subgraph, and is completely independent of the number of nodes in the subgraph. For example, consider a subgraph of node A, where A has 10 children, and each child contains 10 children, and each grandchild contains 10 children. This subgraph has a total of 1111 nodes (1 root + 10 children + 10*10 grandchildren + 10*10*10 great-grandchildren). Finding the nodes in this subgraph would normally require 1 query per node (in other words, 1111 queries). But with this subgraph query mechanism, all of the nodes in the subgraph can be found with 1 insert plus 4 additional join/inserts.

This mechanism has the added benefit that the set of nodes in the subgraph are kept in a working area in the database, meaning they don't have to be pulled into memory.

Subgraph queries are used to efficiently process a number of different requests, including ReadBranchRequest, DeleteBranchRequest, MoveBranchRequest, and CopyBranchRequest. Processing each of these kinds of requests requires knowledge of the subgraph, and in fact all but the ReadBranchRequest need to know the complete subgraph.

Constructor Summary
Method Summary
 void configure(org.hibernate.ejb.Ejb3Configuration configurator)
          Configure the entity class that will be used by JPA to store information in the database.
 RepositoryConnection createConnection(JpaSource source)
Methods inherited from class
equals, getDescription, getDescription, getName, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail


public SimpleModel()
Method Detail


public void configure(org.hibernate.ejb.Ejb3Configuration configurator)
Configure the entity class that will be used by JPA to store information in the database.

Specified by:
configure in class Model
configurator - the Hibernate Ejb3Configuration component; never null


public RepositoryConnection createConnection(JpaSource source)
Specified by:
createConnection in class Model

Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.