|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.garret.consus.ConsusRef
JDBC 2.0 A reference to an SQL structured type value in the database. A Ref can be saved to a persistent storage. A Ref is dereferenced by passing it as a parameter to an SQL statement and executing the statement.
Constructor Summary | |
---|---|
ConsusRef(long oid)
Construct a reference to the object with the specified OID |
|
ConsusRef(PersistentObjectStorage db,
long oid)
Construct a reference to the object with the specified OID |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object obj)
Compare two OID as longs |
boolean |
equals(java.lang.Object ref)
Compare two references for equality |
java.lang.String |
getBaseTypeName()
Gets the fully-qualified SQL structured type name of the referenced item. |
java.lang.Object |
getObject()
Retrieves the SQL structured type instance referenced by this Ref object. |
java.lang.Object |
getObject(java.util.Map map)
Retrieves the referenced object and maps it to a Java type using the given type map. |
long |
getOid()
Get the OID. |
int |
hashCode()
Rerference the hash code. |
void |
setObject(java.lang.Object value)
Sets the structured type value that this Ref
object references to the given instance of Object . |
java.lang.String |
toString()
Convert reference to a String. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ConsusRef(long oid)
oid
- OID of the object or 0public ConsusRef(PersistentObjectStorage db, long oid)
oid
- OID of the object or 0Method Detail |
---|
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
-1
if less than, 0 if equal, and 1 if greaterpublic boolean equals(java.lang.Object ref)
equals
in class java.lang.Object
true
if there are references to the same object or
null
references, false
otherwise.public java.lang.String getBaseTypeName() throws java.sql.SQLException
getBaseTypeName
in interface java.sql.Ref
java.sql.SQLException
- if a database access error occurspublic java.lang.Object getObject() throws java.sql.SQLException
Ref
object. If the connection's type map has an entry
for the structured type, the instance will be custom mapped to
the Java class indicated in the type map. Otherwise, the
structured type instance will be mapped to a Struct
object.
getObject
in interface java.sql.Ref
Object
that is the mapping for
the SQL structured type to which this Ref
object refers
java.sql.SQLException
- if a database access error occurssetObject(java.lang.Object)
public java.lang.Object getObject(java.util.Map map) throws java.sql.SQLException
getObject
in interface java.sql.Ref
map
- a java.util.Map
object that contains
the mapping to use (the fully-qualified name of the SQL
structured type being referenced and the class object for
SQLData
implementation to which the SQL
structured type will be mapped)
Object
that is the custom mapping for
the SQL structured type to which this Ref
object refers
java.sql.SQLException
- if a database access error occurssetObject(java.lang.Object)
public final long getOid()
public int hashCode()
hashCode
in class java.lang.Object
public void setObject(java.lang.Object value) throws java.sql.SQLException
Ref
object references to the given instance of Object
.
The driver converts this to an SQL structured type when it
sends it to the database.
setObject
in interface java.sql.Ref
value
- an Object
representing the SQL
structured type instance that this
Ref
object will reference
java.sql.SQLException
- if a database access error occursgetObject()
,
getObject(Map)
,
PreparedStatement.setObject(int, Object)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |