Chapter 6 Flashcards

1
Q

objects vs. relational dbs

structure:

A

complex values, ollections, class hierarchies(inheritance) vs. flat tables
relationships: binary, 1:1, 1:n, n:m (using collections), uni-b-directional references vs. binary, 1:1, 1:n, value-based, symmetric
behavior: methods vs. NOTHING
access paradigm: objcect navigation (follow references) vs. declarative, set-oriented (queries)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Object relational mappping:

A
  • Object class: to single table or to multiple tables to support inheritance and complex field values
  • object reference as foreing key constraint
  • instance object to one or more rows in a table
  • data types and values need to consider variable length data (strings), differences in the type models, semantics
  • mapping tool support: top-down, bottom-up; meet-in-the-middle
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The CRUD pattern

A

create, read/retrieve, update, delete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the aspects of persistence?

A
Orthogonal persistence (persistence independent of data type class. Instance of the same class may be transient or persistent)
Transitive persistence (persistence by reachability). Objects can be explicitly designed to become persistent and objects referenced by persisted objects are automatically persisted
Persistence independence (transparent persistence) (code on transient and persistent objects is almost the same.  Application may have to explicit persist an OBJECT and the interactions with a data store are not visible to the client object (it happens automatically when object is modified or at EOT)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Java persistence api - JPA

A

Java standard for persistence framework
result of a major „overhaul“ of EJB specification for persistence, relationships, and query support
It can be used from within an EJB environment/container or outside EJB,e.g., withing a standard JAVa SE application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Entities is JPA is a POJO (plain old java object).

A
Class has to be designated (annotated) as entity class
Mapping of Meta-data are done by use of annotations for persistence and relationship aspect or, alternatively, XML deployment descriptor.
Abstract and concrete classes can be entities
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Inheritance mapping strategies

A
See chap 6 slide 15
*single table with discriminator column (default)
*Horizaontal partitioning (single table per concrete entity class)
Vertical partitioning (separate table per subclass)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Name advantages and disadvantages of each inheritance mapping strategies:

A

Single table with discriminator column: Adv: everything in a single table. Simple and fast to query. Disadv: A lot of unnecessary space in database is used because of the empty columns.
Horizontal partitioning: adv: solve the problems of use of unecessary space in database. Disadvantage: More tables, more complex.
Vertical partitioning. The same as horizontal partitioning. BUt the data must always be collected from multiple tables, meanwhile in horizontal partitioning it’s possible to collect data from a specific class directly from its specific table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

which are the inheritance mapping strategies?

A

Single table with discriminator column:, Horizontal partitioning:, Vertical partitioning.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Automatic Persistence. What are the strategies for loading objects from the persistent store during navigational access?

A

Lazy loading - object is retrieved when accessed based on primary key or reference
Eager loading - when an object is requested, transitively load all the object reachable through references. May cause a lot of unnecessary objects to be loaded.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In order to write object changes back to the data store you have immediate update and deferred update. Explain them:

A
  • immediate update (many interactions with the DBMS)
  • Deferred update (record changes and combine them into a single update per tuple at the end of the transaction)(write back changes also before any object query statements are executed)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the concurrency control strategies?

A
Pessimistic (locking at the DBMS-level)
Optimistic locking (inconsistencies may arise if entities are not protected by a version attribute; it does not guarantee consistent reads; conflicts can only be detected at the end of a transaction)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly