@@ -10,6 +10,112 @@ This repository includes the following examples:
1010* [ example-criteria] ( example-criteria ) - Uses the Criteria API.
1111* [ example-jpms] ( example-jpms ) - Uses the Java Platform Module System (JPMS).
1212
13+ ER diagram
14+ ---------------------
15+
16+ The ER diagram for the database used in the example projects is shown below.
17+
18+ ``` mermaid
19+ erDiagram
20+ DEPARTMENT {
21+ INTEGER id PK "not null"
22+ VARCHAR name "not null"
23+ INTEGER version "not null"
24+ }
25+ EMPLOYEE {
26+ INTEGER id PK "not null"
27+ VARCHAR name "not null"
28+ INTEGER age "not null"
29+ INTEGER salary
30+ VARCHAR job_type
31+ TIMESTAMP hiredate
32+ INTEGER department_id
33+ INTEGER version "not null"
34+ TIMESTAMP inserttimestamp
35+ TIMESTAMP updatetimestamp
36+ }
37+ USER {
38+ INT id PK "auto_increment"
39+ VARCHAR name "not null"
40+ VARCHAR email "unique not null"
41+ TIMESTAMP created_at "default current_timestamp"
42+ INT version "default 0 not null"
43+ }
44+ ROLE {
45+ INT id PK "auto_increment"
46+ VARCHAR name "unique not null"
47+ INT version "default 0 not null"
48+ }
49+ USER_ROLE {
50+ INT id PK "auto_increment"
51+ INT user_id "not null"
52+ INT role_id "not null"
53+ INT version "default 0 not null"
54+ }
55+ PRODUCT {
56+ INT id PK "auto_increment"
57+ VARCHAR name "not null"
58+ DECIMAL price "not null"
59+ INT stock_quantity "not null"
60+ TIMESTAMP created_at "default current_timestamp"
61+ INT version "default 0 not null"
62+ }
63+ CATEGORY {
64+ INT id PK "auto_increment"
65+ VARCHAR name "unique not null"
66+ INT version "default 0 not null"
67+ }
68+ PRODUCT_CATEGORY {
69+ INT id PK "auto_increment"
70+ INT product_id "not null"
71+ INT category_id "not null"
72+ INT version "default 0 not null"
73+ }
74+ ORDER {
75+ INT id PK "auto_increment"
76+ INT user_id "not null"
77+ TIMESTAMP order_date "default current_timestamp"
78+ VARCHAR status "not null"
79+ INT version "default 0 not null"
80+ }
81+ ORDER_ITEM {
82+ INT id PK "auto_increment"
83+ INT order_id "not null"
84+ INT product_id "not null"
85+ INT quantity "not null"
86+ DECIMAL price "not null"
87+ INT version "default 0 not null"
88+ }
89+ PAYMENT {
90+ INT id PK "auto_increment"
91+ INT order_id "unique not null"
92+ DECIMAL amount "not null"
93+ TIMESTAMP payment_date "default current_timestamp"
94+ INT version "default 0 not null"
95+ }
96+ REVIEW {
97+ INT id PK "auto_increment"
98+ INT user_id "not null"
99+ INT product_id "not null"
100+ INT rating "check: 1-5"
101+ TEXT comment
102+ TIMESTAMP created_at "default current_timestamp"
103+ INT version "default 0 not null"
104+ }
105+
106+ EMPLOYEE }|..|| DEPARTMENT : belongs_to
107+ USER_ROLE }|..|| USER : "user_id"
108+ USER_ROLE }|..|| ROLE : "role_id"
109+ PRODUCT_CATEGORY }|..|| PRODUCT : "product_id"
110+ PRODUCT_CATEGORY }|..|| CATEGORY : "category_id"
111+ ORDER }|..|| USER : "user_id"
112+ ORDER_ITEM }|..|| ORDER : "order_id"
113+ ORDER_ITEM }|..|| PRODUCT : "product_id"
114+ PAYMENT ||--|| ORDER : "order_id"
115+ REVIEW }|..|| USER : "user_id"
116+ REVIEW }|..|| PRODUCT : "product_id"
117+ ```
118+
13119Clone this repository
14120---------------------
15121
0 commit comments