Package overit.geocall.sql
Class DBObject
java.lang.Object
overit.geocall.sql.DBObject
- All Implemented Interfaces:
DBObjectMap
The object realizes the memorization of a DB SQL object. It implements
DBObjectMap, so has
the map properties for the memorization; furthermore has a member variable that will be properly
transformed in the statement saving phase.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the Java object instanceintgetType()Returs the type (Types) with which the object was instantiatedloadInstance(ResultSet rs, int field) Loads the Java content of the instance and its SQL type from theResultSetand theResultSetMetaDatavoidsaveInstance(PreparedStatement ps, int field, Object o) Registers the instance of the object passed (that mus always be aDBObject) in aPreparedStatementvoidSets the content (the Java object) of the instancevoidsetType(int type) Sets the type (Types)toString()Returns the string representation of the DBObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface overit.geocall.sql.DBObjectMap
loadInstance, loadInstance
-
Field Details
-
_type
protected int _typeSQL type extract from the constantsTypes -
_o
Instance readed directly from the DB
-
-
Constructor Details
-
DBObject
Creates the object starting from a Java object and a type (Types) that defines the save mode- Parameters:
o- The Java objecttype- The SQL type
-
-
Method Details
-
getObject
Returns the Java object instance- Returns:
- The Java object instance
-
getType
public int getType()Returs the type (Types) with which the object was instantiated- Returns:
- The type with which the object was instantiated
-
setObject
Sets the content (the Java object) of the instance- Parameters:
o- The Java object to set
-
setType
public void setType(int type) Sets the type (Types)- Parameters:
type- The SQL type that defines the save mode
-
loadInstance
Loads the Java content of the instance and its SQL type from theResultSetand theResultSetMetaData- Specified by:
loadInstancein interfaceDBObjectMap- Parameters:
rs- The reading sourcefield- The field from which read- Returns:
- FReturns itself with the new contents readed from the DB
- Throws:
SQLException- If an error occurs during the reading from the DB, anSQLExceptionwill be raised
-
saveInstance
Registers the instance of the object passed (that mus always be aDBObject) in aPreparedStatement- Specified by:
saveInstancein interfaceDBObjectMap- Parameters:
ps- The PreparedStatement on which register the objectfield- The field of the PreparedStatemento- The object to save- Throws:
SQLException- If an error occurs during the writing on the PreparedStatement, anSQLExceptionwill be raised
-
toString
Returns the string representation of the DBObject
-