Class JOP.persist.jdbc.JdbcPersistManager
All Packages  Class Hierarchy  This Package  Previous  Next  Index  Home

Class JOP.persist.jdbc.JdbcPersistManager

java.lang.Object
   |
   +----JOP.persist.PersistManager
           |
           +----JOP.persist.jdbc.JdbcPersistManager

public class JdbcPersistManager
extends PersistManager
The JdbcPersistManager supports saving and retrieving objects, and complex graphs of objects to a database via JDBC. The JdbcPersistManager works with any JDBC data source and will run on all Java platforms where JDBC is available.

Before using JdbcPersistManager you should configure the database using JOP.persist.jdbc.JdbcConfig

The JdbcPersistManager implements several useful features:

There are several features on the drawing board, yet to be included in this class including mutli-user support and optimistic locking.

See Also:
JdbcConfig

Constructor Index

 o JdbcPersistManager(String, String, String, String)
Alternate constructor where user_name = dbo_user_name
 o JdbcPersistManager(String, String, String, String, String, String)
Prepares to open a connection to a specific database server.

Method Index

 o close()
Close a previously open connection to the persistent data source.
 o open()
Establish the connection to the datasource via JDBC using the information passed to the constructor.
 o streamInObject(long)
Retrieves an object previously saved by 'streamOutObject()'.
 o streamOutObject(Object)
Save the object on the database.

Constructors

 o JdbcPersistManager
  public JdbcPersistManager(String driver,
                            String url,
                            String unam,
                            String upwd,
                            String onam,
                            String opwd) throws Exception
Prepares to open a connection to a specific database server. Both a normal user name and a database owner (dbo) user name can be specified. The dbo user name is used for all table and index creation operations.

This method does not open the connection, but rather prepares the information needed to open the connection. The open() method should be invoked to complete the connection.

See Also:
open
 o JdbcPersistManager
  public JdbcPersistManager(String driver,
                            String url,
                            String unam,
                            String upwd) throws Exception
Alternate constructor where user_name = dbo_user_name

Methods

 o open
  public void open() throws Exception
Establish the connection to the datasource via JDBC using the information passed to the constructor.

Overrides:
open in class PersistManager
 o close
  public void close() throws Exception
Close a previously open connection to the persistent data source.
Overrides:
close in class PersistManager
 o streamOutObject
  public long streamOutObject(Object o) throws Exception
Save the object on the database. The object can implement Persistable, have a custom marshall class available or can be automatically marshalled. The object and all of the objects referenced by the object are saved. Loops are detected and avoided.

To retrieve the object call 'streamInObject()'

Parameters:
o - The object to be saved
Returns:
s The unique identifier of the object
Overrides:
streamOutObject in class PersistManager
See Also:
streamInObject
 o streamInObject
  public Object streamInObject(long xid) throws Exception
Retrieves an object previously saved by 'streamOutObject()'. The unique object id is passed and an object and all of the objects referenced by the object are returned. The object will be an instance of the same type that was saved and will have the same context. The caller of this method must explicitly cast the returned object before using it.

Within a consistency unit multiple reads of an object either directly (via this method) or indirectly because the object is referenced by another object will not create secondary instances.

Parameters:
id - Unique indentifier of the object
Returns:
s The object
Overrides:
streamInObject in class PersistManager
See Also:
streamInObject, streamOutObject


All Packages  Class Hierarchy  This Package  Previous  Next  Index  Home