|
|||||||||
| Home >> All >> org >> [ odmg overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.odmg
Interface Database

- public interface Database
The interface for interacting with an ODMG database. Databases must be opened before starting any transactions that use the database and closed after ending these transactions.
A database application generally begins processing by accessing one or more
critical objects and proceeding from there. These objects are root objects,
because they lead to interconnected webs of other objects.
The ability to name an object (using method bind) and
retrieve it later by that name (using method lookup facilitates
this start-up capability. A name is not explicitly defined as an attribute of
an object. Naming an object also makes it persistent.
There is a single flat name scope per database; thus all names in a particular database are unique.
- Version:
- ODMG 3.0
| Field Summary | |
static int |
NOT_OPEN
The database is not open. |
static int |
OPEN_EXCLUSIVE
The database is open for exclusive access. |
static int |
OPEN_READ_ONLY
The database is opened for read-only access. |
static int |
OPEN_READ_WRITE
The database is opened for reading and writing. |
| Method Summary | |
void |
bind(java.lang.Object object,
java.lang.String name)
Associate a name with an object and make it persistent. |
void |
close()
Close the database. |
void |
deletePersistent(java.lang.Object object)
Deletes an object from the database. |
java.lang.Object |
lookup(java.lang.String name)
Lookup an object via its name. |
void |
makePersistent(java.lang.Object object)
Make a transient object durable in the database. |
void |
open(java.lang.String name,
int accessMode)
Open the named database with the specified access mode. |
void |
unbind(java.lang.String name)
Disassociate a name with an object |
| Field Detail |
NOT_OPEN
public static final int NOT_OPEN
- The database is not open.
- See Also:
- Constant Field Values
OPEN_READ_ONLY
public static final int OPEN_READ_ONLY
- The database is opened for read-only access.
- See Also:
- Constant Field Values
OPEN_READ_WRITE
public static final int OPEN_READ_WRITE
- The database is opened for reading and writing.
- See Also:
- Constant Field Values
OPEN_EXCLUSIVE
public static final int OPEN_EXCLUSIVE
- The database is open for exclusive access.
- See Also:
- Constant Field Values
| Method Detail |
open
public void open(java.lang.String name, int accessMode) throws ODMGException
- Open the named database with the specified access mode.
Attempts to open a database when it has already been opened will result in
the throwing of the exception
DatabaseOpenException. ADatabaseNotFoundExceptionis thrown if the database does not exist. Some implementations may throw additional exceptions that are also derived fromODMGException.
close
public void close()
throws ODMGException
- Close the database.
After you have closed a database, further attempts to access objects in the
database will cause the exception
DatabaseClosedExceptionto be thrown. Some implementations may throw additional exceptions that are also derived fromODMGException.
bind
public void bind(java.lang.Object object, java.lang.String name) throws ObjectNameNotUniqueException
- Associate a name with an object and make it persistent.
An object instance may be bound to more than one name.
Binding a previously transient object to a name makes that object persistent.
lookup
public java.lang.Object lookup(java.lang.String name) throws ObjectNameNotFoundException
- Lookup an object via its name.
unbind
public void unbind(java.lang.String name) throws ObjectNameNotFoundException
- Disassociate a name with an object
makePersistent
public void makePersistent(java.lang.Object object)
- Make a transient object durable in the database.
It must be executed in the context of an open transaction.
If the transaction in which this method is executed commits,
then the object is made durable.
If the transaction aborts,
then the makePersistent operation is considered not to have been executed,
and the target object is again transient.
ClassNotPersistenceCapableException is thrown if the implementation cannot make
the object persistent because of the type of the object.
deletePersistent
public void deletePersistent(java.lang.Object object)
- Deletes an object from the database.
It must be executed in the context of an open transaction.
If the object is not persistent, then ObjectNotPersistent is thrown.
If the transaction in which this method is executed commits,
then the object is removed from the database.
If the transaction aborts,
then the deletePersistent operation is considered not to have been executed,
and the target object is again in the database.
|
|||||||||
| Home >> All >> org >> [ odmg overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC