|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IComplexColumns
IComplexColumns is an interface that can be used to handle complex columns as they are written to the SA. The default handling of complex columns in in SA is writting them as serialized objects + an additional column for the hashcode. Sometimes (when the entry records are directly visible to non-space implementations) it is desirable to write a complex column (for example- a collection) as child-records in another table. A string value can also be returned for each complex column and it will be stored in the entries table in an additional column (example: a collection can be stored as a comma-seperated string or a complex column can be stored as a key to another table)
Field Summary | |
---|---|
static int |
CALLMODE_AFTER_OPERATION
|
static int |
CALLMODE_BEFORE_OPERATION
|
Method Summary | |
---|---|
void |
close()
called when SA have shut down |
void |
deleteColumnValue(Connection Con,
com.j_spaces.sadapter.GenericJDBC.ComplexColumnAttributes colAttributes,
String entryUid)
called when an entry row is deleted from entries table (note - if complex column is only stored as an additional string in entry table- no operation is needed. |
String[] |
init(com.j_spaces.sadapter.GenericJDBC.JDBCStorageAdapter sa,
String initParam,
int initMode,
com.j_spaces.sadapter.GenericJDBC.ComplexColumnAttributes[] cCols,
HashMap<Integer,String> m_SQLToDB,
String containerName,
String spaceName,
com.j_spaces.sadapter.GenericJDBC.ConstantStatements m_constantstatements)
Initializes this module, called when SA is initialized. |
String |
newColumnValue(Connection Con,
com.j_spaces.sadapter.GenericJDBC.ComplexColumnAttributes colAttributes,
String EntryUid,
Object columnValue,
int callMode,
boolean updateMode)
called when a new row is inserted to the entries table if m_CColsHandlingMethod.m_EmbeddedColumnName field of the ComplexColumnAttributes is not null the method will be called before insert and is expected to return a string value that will be stored in the entries table . |
com.j_spaces.sadapter.GenericJDBC.ComplexColumnAttributes |
newTableColumn(Connection Con,
com.j_spaces.sadapter.GenericJDBC.ComplexColumnAttributes colAttributes,
int callMode)
Called when a new type of entry is introduced to the SA and a table is created for it. this method might be called twice-before table creation (so it can return names of columns to be added for string value storing) and after table creation (to allow creation of child tables). |
Field Detail |
---|
static final int CALLMODE_BEFORE_OPERATION
static final int CALLMODE_AFTER_OPERATION
Method Detail |
---|
String[] init(com.j_spaces.sadapter.GenericJDBC.JDBCStorageAdapter sa, String initParam, int initMode, com.j_spaces.sadapter.GenericJDBC.ComplexColumnAttributes[] cCols, HashMap<Integer,String> m_SQLToDB, String containerName, String spaceName, com.j_spaces.sadapter.GenericJDBC.ConstantStatements m_constantstatements) throws SQLException
sa
- JDBC storage adapterinitParam
- parameter passed to the SA in its properties
for the IComplexColumns usage (can be a url ) .initMode
- SA initialization mode (value from com.j_spaces.core.sadapter.StorageAdapterInitModecCols
- for initMode = warm start, the list of currently handled complex columnsm_SQLToDB
- (for readonly !) a hashmap that maps each java.sql.Types.xxxx sql type to the type name in the DBcontainerName
- name of the container for this spacespaceName
- name of this space
SQLException
com.j_spaces.sadapter.GenericJDBC.ComplexColumnAttributes newTableColumn(Connection Con, com.j_spaces.sadapter.GenericJDBC.ComplexColumnAttributes colAttributes, int callMode) throws SQLException
Called when a new type of entry is introduced to the SA and a table is created for it. this method might be called twice-before table creation (so it can return names of columns to be added for string value storing) and after table creation (to allow creation of child tables).
Con
- JDBC open connection, any operation should use it
note! dont set autocommit and dont commit .colAttributes
- potential complex column attributes .callMode
- CALLMODE_AFTER_OPERATION or CALLMODE_BEFORE_OPERATION (before or after entries
table creation see method returned value ).
SQLException
String newColumnValue(Connection Con, com.j_spaces.sadapter.GenericJDBC.ComplexColumnAttributes colAttributes, String EntryUid, Object columnValue, int callMode, boolean updateMode) throws SQLException
Con
- JDBC open connection, any operation should use it
note! - dont set autocommit and dont commit .colAttributes
- complex column attributes .EntryUid
- unique id of entry (its primary key value).columnValue
- (non-null) value of complex column .callMode
- CALLMODE_AFTER_OPERATION or CALLMODE_BEFORE_OPERATION (before or after entries
table row insert- see method returned value ).updateMode
- true if this is an update operation, so a value may already
exist for the EntryUid.
SQLException
void deleteColumnValue(Connection Con, com.j_spaces.sadapter.GenericJDBC.ComplexColumnAttributes colAttributes, String entryUid) throws SQLException
Con
- JDBC open connection, any operation should use it
note! - dont set autocommit and dont commit .colAttributes
- Column attribute.entryUid
- unique id of entry (its primary key value).
SQLException
void close() throws SQLException
SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |