< Previous Contents Next >

4.4.- Database Specification


4.4.1.- Entity/Relation Model

Database Diagram

TODO: Add database diagram here

Entities

Article

This entity refers to each of the article sould be saled or rented. Each article has some common fields that would be stored in a single table referencing the tables with the specific fields.

This entity can exist or not but if it doesn't exist, the data environment should have a "Service" entity.

Key Field Name Java Type SQL Type Null Unique
Yes
ID
LaBaseID
object
Not
Yes
-
Description
String
varchar(255)
Not
Not
-
ManufactorID
ReferenceID
table reference
Not
Not
-
Detail Fields
ReferenceID
table reference
Yes
Not
ID (primary key):
The record identificator.
Description:
A short description of the article so it can be found in future searchs.
ManufactorID (foreign key):
A reference to de tables storing the data of manufactors.

Service

This entity refers to each service the enterprise offers to its customers.

This entity can exist or not but if it doesn't exist, the data environment should have an "Article" entity.

Key Field Name Java Type SQL Type Null Unique
Yes
ID
LaBaseID
object
Not
Yes
-
Description
String
varchar(255)
Not
Not
-
Detail Fields
ReferenceID
table reference
Yes
Not
ID (primary key):
The record identificator.
Description:
A short description of the service so it can be found in future searchs.

Manufactor

Optional Entity. Is the entity who will describe the author, company, artist, ... who has the copyright of a specific article. Manufactors will be stored in a single table with reference to tables with specific fields. It is only available when we have an entity "article".

Key Field Name Java Type SQL Type Null Unique
Yes
ID
LaBaseID
object
Not
Yes
-
Name
String
varchar(80)
Not
Not
-
Detail Fields
ReferenceID
table reference
Yes
Not
ID (primary key):
The record identificator.
Name:
A name wich identifies the manufactor.

Supplier

Optional Entity Is the entity that references 3rd parties whose suply us of our articles or whose are the performers of our services.

Key Field Name Java Type SQL Type Null Unique
Yes
ID
LaBaseID
object
Not
Yes
-
Name
String
varchar(80)
Not
Not
-
Detail Fields
ReferenceID
table reference
Yes
Not
ID (primary key):
The record identificator.
Name:
A name wich identifies the suplier.

Customer

Is the entity who buys or borrows an article or receives a service form the enterprise.

Key Field Name Java Type SQL Type Null Unique
Yes
ID
LaBaseID
object
Not
Yes
-
Name
String
varchar(80)
Not
Not
-
First Surname
String
varchar(80)
Not
Not
-
Second Surname
String
varchar(80)
Yes
Not
-
Detail Fields
ReferenceID
table reference
Yes
Not
ID (primary key):
The record identificator.
Name:
The customer's name.
First Surname:
The customer's surname.
Second Surname:
The second surname of the customer (it can be blank).

Employee

Optional Entity. Is the entity who for members of the enterprise whose data must be stored in the enterprise servers. This information is only available on Store/Enterprise Edition. By this implementation we can assign to each employee user permissions specific to him.

Key Field Name Java Type SQL Type Null Unique
Yes
ID
LaBaseID
object
Not
Yes
-
Name
String
varchar(80)
Not
Not
-
First Surname
String
varchar(80)
Not
Not
-
Second Surname
String
varchar(80)
Yes
Not
-
Username
String
varchar(10)
Not
Yes
-
Detail Fields
ReferenceID
table reference
Yes
Not
ID (primary key):
The record identificator.
Name:
The employee's name.
First Surname:
The employee's surname.
Second Surname:
The second surname of the employee (it can be blank).
Username:
The network username for this employee, obviously it can accept nulls and it must be unique in the dataset.

Department

Optional Entity. Stores information about each department of the enterprise.

Key Field Name Java Type SQL Type Null Unique
Yes
ID
LaBaseID
object
Not
Yes
-
Name
String
varchar(80)
Not
Not
-
DependsOf
DepartmentID
self reference
Yes
Not
-
Detail Fields
ReferenceID
table reference
Yes
Not
ID (primary key):
The record identificator.
Name:
The department's name.
DependsOf:
Self-reference to the same table for represent the department hierarchical structure of the enterprise. A "null" value in this field should be used for the top department (Presidence, Corporation Admin, ...) and there should be only one record with that value.

Detail

This entity is used both as an internal system entity as a user entity. Entities of kind Detail are user to filter the articles, services, manufactors, customers and employees. In some cases this entities would have a lot of records so entities "detail" will help the user and the server engine to quickly get search results.

Key Field Name Java Type SQL Type Null Unique
Yes
ID
LaBaseID
object
Not
Yes
-
Name
String
varchar(80)
Not
-
-
Value
String
varchar(80)
Not
-
ID (primary key):
The record identificator.
Name (Detail Name Identificator - lbDNI):
A name wich identifies what kind of detail we are specifying in the corresponding record. It is not unique because we will have some records with the same name and different Value.
Value (Detail Value Filter - lbDVF):
Value used to compare the filter fields of the entity requested in a SQL sentence or a lbnet protocol query.

Relations

Employment

This relation joins the entity "Employee" and "Department".

Key Field Name Java Type SQL Type Null Unique
Yes
DepartmentID
ReferenceID
table reference
Not
-
Yes
EmployeeID
ReferenceID
table reference
Not
-
-
Desciption
String
varchar(255)
Not
Not
-
Salary
int
int
Not
Not
-
HireDate
Date
datetime
Not
Not
DepartmetID, EmployeeID (primary key):
The record identificator.
DepartmentID (foreign key):
A reference to a department record.
EmployeeID (foreign key):
A reference to a employee record.
Description:
A short description of this employment.
Salary:
The salary assigned to this specific employment and this specific employee. It can't be null and not lesser or lower than zero.
HireDate:
The day in which this employee was contracted to work in the specified department to do the job descripted.

Stock

Optional Relation. This relation should be used by servers that are included in a corporative network. This corporation has some main servers containing the information that shares all the company (articles, manufactors, customers, details) and there are some sales-point where they have lite servers managing stock relations.

TODO: Add entity fields table here.

Sales/Borrows

This relation joins articles with customers. The data fields for borrows should be a bit different than the ones for the sales, this is liability of the lbadmin. In servers that are included in a corporative network, this relation references to the stock table because the sales/borrows are matter of each sales-point, the sales/borrows relation of the entire network should be treated like a top-level entity.

TODO: Add entity fields table here.

Supply

This relation joins the articles/services and the suplier. In the cases that we wanna store data about suppliers the data of this relation will be used to auto-update the article/service entity table.

TODO: Add entity fields table here.

4.4.2.- POJO Architecture

Java Types Definitions

package org.jlabase.type

TODO: Add package UML diagram here.

LaBaseID

class LaBaseID

TODO: Add class diagram here.

Abstract key identifier for every data table (POJO class). It gives a default implementation for generating unique sequenced identifiers.


ReferenceID

class ReferenceID

TODO: Add class diagram here.

Foreign key identifier. It can reference to datasets allocated in different locations from the one that owns the relation usign the lbnet protocol.


< Previous Contents Next >