|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.garret.consus.Persistent
Base class for all persistent-capable classes. You should derive your
class from the Persistent
class to support transparent persistency.
Field Summary | |
---|---|
PersistentObjectStorage |
db
|
long |
oid
|
static int |
PO_DELETED
|
static int |
PO_LOADED
|
static int |
PO_NEW
|
static int |
PO_STUB
|
int |
state
|
java.lang.Object |
type
|
Constructor Summary | |
---|---|
Persistent()
|
Method Summary | |
---|---|
long |
assignOID(PersistentObjectStorage db)
Assign a persistent object identifier to the object, if it hasn't been assigned yet. |
void |
become(Persistent obj)
Exchange references between objects in the database. |
void |
beginUpdate()
|
void |
endUpdate()
|
Persistent |
get()
Load stub object from the database. |
static Persistent |
get(Persistent obj)
Load stub object from the database. |
long |
getOid()
Get the objects identifier. |
static long |
getOid(Persistent obj)
Get the objects identifier. |
ConsusRef |
getRef()
Get the objects JDBC reference. |
static ConsusRef |
getRef(Persistent obj)
Get the JDBC reference to the object. |
boolean |
isDeleted()
Check if the object is marked as deleted. |
boolean |
isLoaded()
Check whether the object is a stub. |
boolean |
isNew()
Check whether the object has not yet been stored in the database (assigned the persistent object identifier). |
Persistent |
load()
Load stub object or reload the object from the database. |
boolean |
loadClosure()
Specify whether the referenced objects should be loaded implicitly together with the parent object or not. |
void |
loadComponents()
Load the components of the object. |
void |
lock()
Lock database in exclusive mode. |
void |
remove()
Remove the object from the database. |
boolean |
save()
Store the object in the database if the deferredUpdate flag is 0. |
void |
store()
Store the object attached to the database to the storage. |
void |
store(PersistentObjectStorage db)
Save the object in the database. |
java.lang.String |
toString()
Get the String representation of the persistent objects identifier. |
void |
unget()
Clear all object fields (to make it possible for GC to collect unused persistent objects). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public transient PersistentObjectStorage db
public transient long oid
public static final int PO_DELETED
public static final int PO_LOADED
public static final int PO_NEW
public static final int PO_STUB
public transient int state
public transient java.lang.Object type
Constructor Detail |
---|
public Persistent()
Method Detail |
---|
public long assignOID(PersistentObjectStorage db)
db
- connection to the database in which object should be allocatedpublic void become(Persistent obj)
obj
- object which OID will be exchanged with this
objectpublic final void beginUpdate()
public final void endUpdate()
public Persistent get()
this
public static Persistent get(Persistent obj)
null
value.
this
public long getOid()
public static long getOid(Persistent obj)
obj
- object or null
public ConsusRef getRef()
public static ConsusRef getRef(Persistent obj)
obj
- object or null
public final boolean isDeleted()
true
if remove method was invoked for the object.public final boolean isLoaded()
true
when object has not yet been loaded from the database,
and instead of it a stub was created.public final boolean isNew()
true
if object has no assigned OID yet.public Persistent load()
this
public boolean loadClosure()
true
, so the complete tree of objects will be loaded into memory.
To prevent loading of all objects (and so exhausting the memory), redefine
this method and return false
. In this case you will have
to load the components explicitly.
true
to load all graph with referenced objects or
false
for loading stubs instead of referenced object.public void loadComponents()
public void lock()
public void remove()
public boolean save()
deferredUpdate
flag is 0.
deferredUpdate
flag indicates that the object will be saved by the
caller.
true
if method stores the object, false
otherwisepublic void store()
public void store(PersistentObjectStorage db)
public java.lang.String toString()
toString
in class java.lang.Object
public void unget()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |