In
this section we will extend our quick
start sample into to a web based application
that comprises of struts and Hibernate
support.
Introduction
In this example we will build a simple
web based document repository application
using hibernate. The document repository
under consideration will have categorization
of the documents based on the topics (Folder
based like structure), Keywords for each
document (this will simplify searches),
versioning for each document, Document
modification history, permissions based
access for each entity based on users
and groups.
Database scheme.
The concept of properties tables: Here
we have extended the concept of Hash tables
to the database, Instead of adding more
and more columns as per growing needs
A properties table is created per Entity,
Each property (Prop) table contains name
and value pair that stores additional
information for particular entity, thus
you can store as many properties as you
want for a given entity. Getter and setter
methods need to be provided from the domain
object so that we can represent these
properties inside domain objects.
Basic entities.
Basic entities such as User, Group, and
Permissions along with Prop tables for
each are provided to persistent data for
corresponding entities, Now as a business
rule a group contains multiple Users and
One User can be a part of multiple Groups.
Each entity, User, Group, and Permission
have UserProp, GroupProp and PremissionProp
respectively. The relation between Entity
and Prop is one to many. E.g. User can
have multiple Properties. (For simplicity,
Permission tables are not shown in the
model)
Categories and Documents
Category refers to a Folder/Directory
like structure on the file system. Each
category may or may not have its Parent
Category. Category contains information
like name, description, creation details,
modification deleted and deletion details.
Each category can have multiple entries.
(Each Folder can contain one or more Documents
(Entries) in it. Each Document can have
one or more versions in it.(Document corresponds
to version). Document contains information
such as Title, Body, Summary, life cycle
details, version number, keywords, workflow
status, Entry details and Attachment details;
Document also contains properties associated
with it. Attachment is a file associated
with each Document, Database stores the
name of file stored on the file system
and the size of Attachment.
|