blob: 90642bba2dfe3947321a0a02f493156f503a85be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
== Ormpaloompa — Sort-of-ORM for EduardXVII
Because the friendly MUC chat bot EduardXVII needs to deal in several places
with simple-structured SQLite tables, I created this tiny object-relational
mapper. It stinks in several places, but it also gets its job done. Coverage is
over 85% and should go further north.
It mainly consists of the class `Table` which can be used as follows.
As simple class could look like this:
[source,java]
----
class Bird {
@Column(identity = true)
public Integer id;
@Column
public String name;
}
----
Then create a `Table<Bird>` object and use it to interact with the database.
[source,java]
----
Table<Bird> t = new Table<>(Bird.class, someDatabaseConnection);
Bird newBird = new Bird();
newBird.name = "A new bird";
Object id = table.insert(newBird);
Bird storedBird = t.getById(id).get();
----
|