-
Notifications
You must be signed in to change notification settings - Fork 0
database structure access
Fabian Wurm edited this page Mar 22, 2018
·
1 revision
Um über den H2Handler auf die Datenbank zugreifen zu können muss folgendes beachtet werden:
- Der H2Handler versucht sich auf eine Datenbank mit dem Namen "fotostudio", mit dem Benutzer "sa" und einem leeren Passwort "" anzumelden. Diese Datenbank muss schon erstellt worden sein bevor der H2Handler genutzt werden kann. Dazu beim Verbinden zur Datenbank über das Web-Interface von H2 den neuen Datenbanknamen in die JDBC-URL einfügen und aufrufen, dann wird sie automatisch erstellt.
- Das DBHandler Interface ist zu verwenden. Keine Variable soll als H2Handler deklariert sein.
- Der H2Handler ist als Singleton implementiert.
- Die Implementierung von H2Handler liefert auf getConnection() immer die selbe Connection-Instanz zurück. Das heißt auch, dass diese Connection niemals außerhalb des Handlers geschlossen werden darf, sondern nur über die closeConnection() Funktion im Handler.
Die in den Beispiel-Daten aus dem Insert-Script enthaltenen User-Credentials sind: Adminname: admin Passwort: martin
Wir verfügen über 8 Sequences, allesamt für die Vergabe von IDs für andere Tabellen. Sie alle sind begrenzt auf den Wert 2147483600, der knapp unter Int.MAX_VALUE liegt, somit kann innerhalb der Anwendung trotzdem Datentyp int für IDs verwendet werden, trotz Datentyp BIGINT in der Datenbank. Ist der Maximalwert einer Sequence erreicht wird wieder bei 1 begonnen.
Name | Zugehörige Tabelle |
---|---|
profiles_seq | profiles |
shootings_seq | shootings |
images_seq | images |
positions_seq | positions |
cameras_seq | cameras |
logos_seq | logos |
profile_logo_relativeRectangles_seq | profile_logo_relativeRectangles |
profile_camera_positions_seq | profile_camera_positions |
Attribute | Datatype | Properties | References |
---|---|---|---|
adminname | VARCHAR(20) | PRIMARY KEY | - |
password | BINARY(32) | NOT NULL | - |
Attribute | Datatype | Properties | References |
---|---|---|---|
profileID | BIGINT | DEFAULT profiles_seq.nextval PRIMARY KEY | - |
name | VARCHAR(50) | NOT NULL | - |
isMobilEnabled | BOOLEAN | DEFAULT FALSE | - |
isPrintEnabled | BOOLEAN | DEFAULT FALSE | - |
isFilterEnabled | BOOLEAN | DEFAULT FALSE | - |
isGreenscreenEnabled | BOOLEAN | DEFAULT FALSE | - |
watermark | VARCHAR(250) | NOT NULL DEFAULT '' | - |
isDeleted | BOOLEAN | DEFAULT FALSE | - |
Attribute | Datatype | Properties | References |
---|---|---|---|
shootingID | BIGINT | DEFAULT shootings_seq.nextval PRIMARY KEY | - |
profileID | BIGINT | ON DELETE SET NULL | profiles(profileID) |
folderpath | VARCHAR(250) | NOT NULL | - |
isActive | BOOLEAN | DEFAULT true | - |
Attribute | Datatype | Properties | References |
---|---|---|---|
imageID | BIGINT | DEFAULT images_seq.nextval PRIMARY KEY | - |
imagepath | VARCHAR(250) | NOT NULL | - |
shootingID | BIGINT | NOT NULL ON DELETE CASCADE ON UPDATE CASCADE | shootings(shootingID) |
time | TIMESTAMP | - | - |
Attribute | Datatype | Properties | References |
---|---|---|---|
positionID | BIGINT | DEFAULT positions_seq.nextval PRIMARY KEY | - |
name | VARCHAR(50) | NOT NULL | - |
buttonImagePath | VARCHAR(250) | NOT NULL | - |
isDeleted | BOOLEAN | DEFAULT false | - |
Attribute | Datatype | Properties | References |
---|---|---|---|
cameraID | BIGINT | DEFAULT cameras_seq.nextval PRIMARY KEY | - |
label | VARCHAR(50) | NOT NULL | - |
modelName | VARCHAR(50) | NOT NULL | - |
portNumber | VARCHAR(50) | NOT NULL | - |
serialNumber | VARCHAR(50) | NOT NULL | - |
isActive | BOOLEAN | DEFAULT false | - |
Attribute | Datatype | Properties | References |
---|---|---|---|
profile_camera_positions_id | BIGINT | DEFAULT profile_camera_positions_seq.nextval PRIMARY KEY | - |
profileId | BIGINT | ON DELETE CASCADE | profiles(profileID) |
cameraId | BIGINT | ON DELETE CASCADE | cameras(cameraId) |
positionId | BIGINT | ON DELETE CASCADE | positions(positionID) |
isGreenscreenReady | BOOLEAN | DEFAULT false | - |
UNIQUE KEY (profileId, cameraId) UNIQUE KEY (profileId, cameraId, positionID)
Attribute | Datatype | Properties | References |
---|---|---|---|
logoID | BIGINT | DEFAULT logos_seq.nextval PRIMARY KEY | - |
label | VARCHAR(50) | NOT NULL | - |
path | VARCHAR(250) | NOT NULL DEFAULT '' | - |
isDeleted | BOOLEAN | DEFAULT false | - |
Attribute | Datatype | Properties | References |
---|---|---|---|
profile_logo_relativeRectangles_id | BIGINT | DEFAULT profile_logo_relativeRectangles_seq.nextval PRIMARY KEY | - |
profileId | BIGINT | ON DELETE CASCADE | profiles(profileID) |
logoId | BIGINT | ON DELETE CASCADE | logos(logoId) |
x | DOUBLE | - | - |
y | DOUBLE | - | - |
width | DOUBLE | - | - |
height | DOUBLE | - | - |
UNIQUE KEY (profile_logo_relativeRectangles_id,profileId, logoId)
Attribute | Datatype | Properties | References |
---|---|---|---|
adminname | VARCHAR(20) | PRIMARY KEY | - |
password | BINARY(32) | NOT NULL | - |
Attribute | Datatype | Properties | References |
---|---|---|---|
profileID | INT | AUTO_INCREMENT PRIMARY KEY | - |
name | VARCHAR(50) | NOT NULL | - |
isActive | BOOLEAN | DEFAULT FALSE | - |
Attribute | Datatype | Properties | References |
---|---|---|---|
shootingID | INT | AUTO_INCREMENT PRIMARY KEY | - |
profileID | INT | ON DELETE SET NULL | profiles(profileID) |
folderpath | VARCHAR(250) | NOT NULL | - |
isActive | BOOLEAN | DEFAULT true | - |
Attribute | Datatype | Properties | References |
---|---|---|---|
imageID | INT | PRIMARY KEY | - |
imagepath | VARCHAR(250) | NOT NULL | - |
shootingID | INT | ON DELETE SET NULL | shootings(shootingID) |
time | TIMESTAMP | - | - |