Package fri.util.database.jpa.tree.nestedsets

A "Nested Sets" tree implementation for hierarchical structures in a database table.

See:
          Description

Interface Summary
NestedSetsTreeNode A tree node.
TemporalNestedSetsTreeNode Merges Temporal with NestedSetsTreeNode.
 

Class Summary
NestedSetsTreeDao Data-access-object for a hierarchical representation of records (nodes), using one database table, having no parent reference in children.
NestedSetsTreeTest Unit test for NestedSetsTreeDao and NestedSetsTreeNode.
TemporalNestedSetsTreeDao DAO extension that allows to historicize entities instead of deleting them.
TemporalNestedSetsTreeTest  
 

Package fri.util.database.jpa.tree.nestedsets Description

A "Nested Sets" tree implementation for hierarchical structures in a database table.

See

The NestedSetsTreePojo and TemporalNestedSetsTreePojo classes in this package provide methods to access database tables as trees. The NestedSetsTree and TemporalNestedSetsTree interfaces describes the responsibilities of a domain object against the DAO.

There can be more than one tree in one database table. You can not move a tree from one database table to another, but you can move trees (or sub-trees) within one table. The DbSession interfaces is to abstract the persistence layer from the DAO.

As it is not easy to define unique constraints for trees in database tables, there is an interface UniqueTreeConstraints that describes the responsibilities of such a check. You can pass an implementation of that interface to the DAO for checking uniqueness. Example is UniqueTreeConstraintsImpl. Unit tests, sample POJOs and a Hibernate DbSessionImpl are in parallel test-package (TODO should be in Maven src/test/java directory).

See JNestedSetsTree.html manual in this package for further details.

Glossary

DAO = data access object
POJO = plain old Java object, domain object