java binding for oodb
DESCRIPTION
TRANSCRIPT
Java Binding for OODB
• JDBC, SQLJ– Data-centric
• Java Binding for OODB– Programming objects-centric
• ODMG 2.0– Object Model, ODL, OQL, OOPL– Does not define a common OML
• Mapping– ODMG Object Model, Java ODL, Java OML, Java OQL
• POET 5.0
ODMB Java Binding
• ODMG Java Binding– As a single language
• A single unified type system• Conform to the java language syntax• Automatic memory management
– ODMG 2.0 dos now define• How a java class become a persistence-capable class
– Transparent persistence support• Postprocessor
– Java .class file (bytecode)• Preprocessor
– Modifies the Java Source
Mapping of the ODMG Object Model
• ODMG Object Model– Based on OMG Object Model
• Not yet supported– Extents, Keys, Relationships, Access to meatdata
• Types– ODMG interface == Java interface– ODMG class == Java Class– ODMG is-a relationship == Java extends– Is-a relationship between classes and interface
• Java implements
Mapping of the ODMG Object Model
• Objects– Java root objects
• Java ODL– Object-oriented database schema as a set of java classes– Attributes
• Field declaration– Operations
• Method declaration
• Java OML– Create, delete, reference, get/set field values– Invoke method on a persistent(database) object– Attributes
• Accessing attributes– Operations
• Mapped to method
Object Life Cycle
• Begin processing– Accessing one or more of the root objects
• Persistent• Entry point to the database
• Persistence– Transient object
• Referenced by a persistent object
• Modification to persistent object– Transaction committed
• Automatically removed– Neither named nor referenced by any other
persistent object
Collection Interfaces
• Java OML provides– Public interface Set extends Collection { .. }– Public interface Bag extends Collection
{ .. }– Public interface List extends Collection { .. }
• Collection interface– Page 178
Transactions
• All creation, access and modification of persistent object– Within a transaction
• Implement Java OML as object– Page 178
• Thread ca be used with transaction– Exactly one thread under exactly one transaction– Multiple thread each with its own separate transaction
• Must not pass object from one thread to another– Multiple thread may share one or more transactoin
• Using Java synchronization
Database Operations
• Java OML as objects of the Database class– Page 179
• No constructor provided– Open() to create and open a database– Bind()
• Manipulate ob object• Binding transient object to a name make that
object persistent
– Lookup()• Access an object by name
Java OQL
• Full functionality of OQL is available• Collection interface provides
– Public Object selectElement(String predicate);– Public boolean existsElement(String predicate);– Public Enumeration select(String predicate);– Public Collection query(String predicate);
• Predicate is a string with the syntax of the WHERE
• OQLQuery class– To create a query, pass parameters, execute the q
uery, get the result– Page 180
POET 5.0
• POET Java SDK– ODMG Java Binding– Preprocessor approach
• Java source to add persistence support• Create the schema and database for persistent
object
• POET database– Dictionary
• Contain information about the structure of persistence-capable classes
– Database• Persistent object stored
• Extents, Keys, and Names