IT Boxing Championship - PowerPoint PPT Presentation

About This Presentation
Title:

IT Boxing Championship

Description:

book.addAuthor(lambo); book.addAuthor(gruiu); //store complex object. database.set(book) ... get author 'Lambo' Author proto = new Author('Lambo' ... – PowerPoint PPT presentation

Number of Views:67
Avg rating:3.0/5.0
Slides: 19
Provided by: itboxingc
Learn more at: https://www.devbg.org
Category:

less

Transcript and Presenter's Notes

Title: IT Boxing Championship


1
Svetoslav Kapralov
2
Contents
  • DB4O Overview
  • OODBMS vs. RDBMS
  • What is DB4O
  • DB4O Basics
  • Object Container
  • CRUD
  • Activation
  • Transactions

3
DB4O Overview
4
O?DBMS (db4o) vs. RDBMS
  • Object-oriented programming (OOP) and relational
    databases (RDBMS) do not match up
  • An object database (ODBMS) stores objects
    directly

5
What is db4o?
  • Open source object database
  • Designed for embedded
  • 1,000,000 downloads,
  • 20,000 registered community members
  • 200 customers
  • Dual license model (GPL / commercial)
  • db4o is up to 55x faster than Hibernate RDBMS!

6
What is db4o?
  • No Database Administrator required
  • No conversion or mapping needed since objects are
    stored as they are
  • Only one line of code to store objects of any
    complexity natively
  • Installation by adding a single library file

7
DB4O Basics
8
Object Container
  • Represents db4o databases
  • Supports local file mode or client connections to
    db4o server
  • All operations are executed transactional
  • Maintains references to stored and instantiated
    objects

9
Storing Objects
  • Objects stored using method set of
    ObjectContainer
  • Stores objects of arbitrary complexity

ObjectContainer database Db4o.openFile("test.db"
) // create a publication Book book new
Book(db4o") // create authors Author lambo
new Author(Lambo") Author gruiu new
Author(Gruiu") // assign authors to
book book.addAuthor(lambo) book.addAuthor(gruiu)
//store complex object database.set(book)
10
Retrieving Objects
  • db4o supports three query languages
  • QBE
  • Native query
  • SODA

11
Query by Example
  • simple method based on prototype objects

ObjectContainer database Db4o.openFile("test.db"
) // get author Lambo" Author proto new
Author(Lambo") ObjectSetltAuthorgt authors
database.get(proto) for (Author author authors)
System.out.println(author.getName()) // get
all books ObjectSetltBookgt books
database.get(Book.class) for (Book book books)
System.out.println(book.getTitle())
12
Native Queries
  • type safe
  • transformed to SODA and optimized

ObjectContainer database Db4o.openFile("test.db"
) // find all books after 1995 ObjectSetltBookgt
books database.query( new PredicateltBookgt()
public boolean match(Book book) return
book.getYear() gt 1995 ) for (Book book
books) System.out.println(book.getTitle())
13
Update / Delete Objects
  • Update procedure for persistent object
  • retrieve desired object from the database
  • perform the required changes and modification
  • store object back to the database by calling the
    set method
  • Delete procedure for persistent object
  • retrieve desired object from the database
  • method delete of ObjectContainer removes objects

14
CRUD Summary
  • Storing of new objects using the set method
  • object graph is traversed and all referenced
    objects are stored
  • Updating of existing objects using the set method
  • by default update depth is set to one
  • only primitive and string values are updated
  • object graph is not traversed for reasons of
    performance

15
CRUD Summary
  • Deleting existing objects using the delete method
  • by default delete operations are not cascaded
  • referenced objects have to be deleted manually
  • cascading delete can be configured for individual
    classes

16
Activation
  • Activation controls instantiation of object
    fields
  • object field values are loaded into memory only
    to a certain depth when a query retrieves objects
  • activation depth denotes the length of the
    reference chain from an object to another
  • fields beyond the activation depth are set to
    null for object references or to default values
    for primitive types

17
Activation
  • Activation depth trade-off
  • set to maximum
  • set to minimum
  • Controlling activation
  • default activation depth is 5
  • methods activate and deactivate of
    ObjectContainer
  • per class configuration

18
Transactions
  • ACID transaction model
  • Data transaction journaling
  • zero data loss in case of system failure
  • automatic data recovery after system failure
  • db4o core is thread-safe for simultaneous
    operations
  • db4o uses the read committed isolation level
Write a Comment
User Comments (0)
About PowerShow.com