Skip to content

Commit e17802d

Browse files
Merge pull request #1 from JavaWebStack/TimothyGillespie/addORMGoals
Add feature target for v1
2 parents b6eb052 + 345f692 commit e17802d

1 file changed

Lines changed: 91 additions & 1 deletion

File tree

docs/framework/orm/index.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,97 @@
11
# Overview
22
## About
3-
The ORM (Object-Relational-Mapping) allows you to access SQL databases without any need to write sql query strings or map between sql and java. This is all done by the ORM for you and even more.
3+
The ORM (Object-Relational-Mapping) allows you to access SQL databases without any need to write SQL query strings or map between SQL and java.
44
[Getting Started](/docs/orm/getting-started)
5+
6+
## Goals and State of the Project
7+
The ORM attempts to make sensible decisions for developers while also granting the ability to overwrite these decisions. To illustrate this with an example:
8+
9+
The ORM ships with a DefaultMapper, which specifies, for instance, what Field in your model maps to which SQL datatype. You have the option to use your definition and partially use ours when it fits you already.
10+
11+
We consider our v1.0 goals achieved when the following features are implemented:
12+
13+
Type Definition:
14+
Elementary - If this feature is not included there will be SQL features which will become impossible to perform with the ORM.
15+
16+
Utility - If this feature is not included the developer will not be limited in options but needs to write more code to achive the same code
17+
18+
Decision - A utility feature, which forces some convention on the developer and should, thusly, be overwritable.
19+
20+
### Relation Mapping
21+
22+
|Achieved|Tested|Implemented|Feature|Type|
23+
| - | - | - | - | - |
24+
| | | | Spec is WIP | Info |
25+
26+
### Query Building
27+
|Achieved|Tested|Implemented|Feature|Type|
28+
| - | - | - | - | - |
29+
| No | No | No | SELECT Clause (default: SELECT *) | Elementary |
30+
| No | No | Yes | FROM Clause derived from Model | Elementary |
31+
| No | No | Yes | WHERE Clause | Elementary |
32+
| No | No | Yes | Nested WHERE Clause | Elementary |
33+
| No | No | Yes | WHERE EXISTS Clause | Elementary |
34+
| No | No | No | whereHas | Utility |
35+
| No | No | No | has | Utility |
36+
| No | No | Yes | ORDER BY Clause | Elementary |
37+
| No | No | No | GROUP BY Clause | Elementary |
38+
| No | No | Yes | OFFSET Clause | Elementary |
39+
| No | No | Yes | LIMIT Clause | Elementary |
40+
| No | No | Yes | HAVING Clause | Elementary |
41+
| No | No | Yes | Belongs To (1:n) Relation | Utility |
42+
| No | No | Yes | Has Many (n:1) Relation | Utility |
43+
| No | No | Yes | Belongs To Many (n:n) Relation | Utility |
44+
| No | No | Only Count | Aggregate Functions (only aggregate value returned) | Elementary |
45+
| No | No | No | Aggregate Function (in conjunction with GROUP BY) | Elementary |
46+
| No | No | No | Aggregate Function (with default value for null) | Elementary |
47+
48+
### Automatic Migration
49+
|Achieved|Tested|Implemented|Feature|Type|
50+
| - | - | - | - | - |
51+
| No | No | Yes | Default Size per config | Utility |
52+
| No | No | Yes | Size per configurable per column | Essential |
53+
| No | No | Yes | Table name is the plural of class name | Decision |
54+
| No | No | Yes | Table name per configurable per model | Essentials |
55+
| No | No | Yes | Column name is snake case of attribute name | Decision |
56+
| No | No | Yes | Column name convention is overwritable to other cases | Utility |
57+
| No | No | Yes | Column name is configurable per column | Essential |
58+
| No | No | No | An index can be set per column | Essential |
59+
| No | No | Yes | A primary key can be set per column | Essential |
60+
| No | No | No | A primary key can be set across multiple columns | Essential |
61+
| No | No | Yes | A unique attribute can be set per column | Essential |
62+
| No | No | No | A foreign key can be set per column | Essential |
63+
| No | No | No | ON DELETE | Essential |
64+
| No | No | No | ON UPDATE | Essential |
65+
| No | No | No | On Soft Delete | Utility |
66+
| No | No | Yes | Auto-increment can be configured per column | Essential |
67+
| No | No | No | Not nullable can be configured per column | Essential |
68+
69+
### Processing
70+
|Achieved|Tested|Implemented|Feature|
71+
| - | - | - | - |
72+
| No | No | Yes | Timestamps (Created At, Updated At) | Utility |
73+
| No | No | Yes | Soft Deletes | Utility |
74+
| No | No | Yes | Observer | Utility |
75+
76+
### Security
77+
|Achieved|Tested|Implemented|Feature|
78+
| - | - | - | - |
79+
| No | No | No | SQL Injection Protection |
80+
81+
### Not included but considered features
82+
|Feature|Type|Reason|
83+
| - | - | - |
84+
| Raw Query Fragments | Essential | They pose a big challenge to our typing though they might get a lose AbstractObject typing in later versions |
85+
| Joins | Essential | They were the subject of internal discussions, and we aim to support them in later versions
86+
| Configurable Encoding/Collation | Essential | We decided only to support utf8mb4_unicode_ci collation for simplicity's sake. We might add this much later |
87+
| Unsigned Propery | Essential | We could offer this easily by simply plugging in the setting in the SQL Syntax and existing databases with unsigned columns already work. The Datatype ranges in Java, however, do not support it and can overflow. We want to introduce our own unsigned types later.
88+
89+
### Current Design Flaws and architectural impurities
90+
- Relationships are not their own types, and their methods placed on the model
91+
- We don't treat exceptions soundly
92+
- An id field is currently necessary (we could dynamically go via the attributes primary key and unique and otherwise match all data with LIMIT 1)
93+
94+
595
## Maven (Standalone Usage)
696
```xml
797
<repository>

0 commit comments

Comments
 (0)