The object database: identity and navigation
Why an object database exists: the mismatch between a graph of objects and tables, the object identifier, persistent objects, and navigating from reference to reference instead of joining.
- 24 cards
- 5 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- Scenarios
- Understand
A few cards from the deck
Object database: what is it?
Show the answer
A database that stores a program's objects directly, with their identity, references, collections and inheritance, instead of cutting them into table rows.
The program handles objects linked to one another; the database keeps them as they are, with no translation to another model on every read and write.
What is
a == bin Java for two objects created like this, with noequalsmethod overridden?
```java
Adresse a = new Adresse("12 rue Pasteur", "Lyon");
Adresse b = new Adresse("12 rue Pasteur", "Lyon");
System.out.println(a == b);`falsetrue- A runtime error
- A compilation error
Show the answer
false==compares references, hence identities:aandbare two distinct objects, even with the same values. This is exactly the distinction that the object identifier makes durable in a database.A … object survives the end of the program that created it; a … object vanishes with it.
Show the answer
A persistent object survives the end of the program that created it; a transient object vanishes with it.
Persistence is a property of the object (or of its class), not of the language: the database is what makes the object durable.
Object identifier: what is it?
Show the answer
An identity the database gives each object, independent of its values, which never changes during the object's life.
A relational primary key is a value of the row and can be changed; the object identifier is not a value, it is what designates the object even when all its attributes change.
A design tool loads assemblies of parts nested ten levels deep and spends its time in joins. What is the cause, and which storage answers it?
- A deep graph rebuilt table by table; storage that navigates by reference
- Too few indexes; adding an index on every foreign key is enough to remove the joins
- Over-normalised tables; they must be brought to second normal form
- A slow database; a read replica is enough
Show the answer
A deep graph rebuilt table by table; storage that navigates by reference
Ten levels means ten joins to rebuild one assembly. An index speeds up each join without removing it, a replica does not remove the rebuilding, and denormalising does not remove the levels: a part that contains parts is still one join per level.