Oracle® TimesTen In-Memory Database Java Developer's Guide Release 11.2.1 Part Number E13068-02 |
|
|
View PDF |
This chapter provides reference information for the JMS/XLA API. It includes the following topics:
Note:
"Access control impact on XLA" introduces the effects of TimesTen access control features on XLA functionality.A javax.jms.MapMessage
contains a set of typed name/value pairs that correspond to the fields in an XLA update header, which is published as the C structure ttXlaUpdateDesc_t
. The fields contained in a MapMessage
instance depend on what type of update it is.
Each MapMessage
returned by the JMS/XLA API contains at least one name/value pair called __TYPE
(with 2 underscores) that identifies the type of update described in the message as an integer value. The types are specified as integer values. As a convenience, you can use the constants defined in com.timesten.dataserver.jmsxla.XlaConstants
to compare against the integer types. Table 6-1 shows the supported types.
Table 6-1 XLA update types
For all update types, the MapMessage
contains name/value pairs that indicate the following:
Whether this is the first record of a transaction.
Whether this is the last record of a transaction.
Whether the update was performed by replication.
Which table was updated.
The owner of the updated table.
The name/value pairs that contain these XLA flags are described in Table 6-2. Each name is preceded by two underscores:
Table 6-2 JMS/XLA flags
Name | Description | Corresponding ttXLATblDesc_t field |
---|---|---|
|
Indicates that a delete was due to aging. The flag is present only if the XLA update record is due to an aging delete. The |
|
|
Indicates that a delete was due to a cascading delete. The flag is present only if the XLA update record is due to a cascading delete. The |
|
|
Indicates that this is the last record in a transaction and that a commit was performed after this operation. Only included in the |
|
|
Indicates that this is the first record in a new transaction. Only included in the |
|
|
Indicates that this change was applied to the database through replication. Only included in the |
|
|
Only used for UPDATETUP records, this flag indicates that the XLA update descriptor contains a list of columns that were actually modified by the operation. Specified as a String that contains a semicolon delimited list of column names. Only included in the |
|
Note:
TheXlaConstants
interface is in the com.timesten.dataserver.jmsxla
package.Applications can use the MapMessage
method itemExists()
to determine whether a flag is present, and getBoolean()
to determine whether a flag is set. As input, specify the XlaConstants
constant that corresponds to the flag, such as XlaConstants.AGING_DELETE_FIELD
.
Many DML operations generate XLA updates that can be monitored by XLA event handlers. This section describes the contents of the MapMessage
objects that are generated for these operations.
For INSERT, UPDATE and DELETE operations, MapMessage
contains two name/value pairs called __TBLOWNER
and __TBLNAME
. These fields describe the name and owner of the table that is being updated. For example, for a table SCOTT.EMPLOYEES, any related MapMessage
contains a field called __TBLOWNER
with a value that is the string "SCOTT" and a field called __TBLNAME
with a value that is the string "EMPLOYEES".
For INSERT and DELETE operations, a complete image of the inserted or deleted row is included in the message and all column values are available.
For UPDATE operations, the complete "before" and "after" image of the row is available, as well as a list of column numbers indicating which columns were actually modified. You access the column values using the names of the columns. The column names in the "before" image all begin with a single underscore. For example, columnname
contains the new value and _columnname
contains the old value.
If the value of a column is NULL, it is omitted from the column list. The __NULLS
name/value pair contains a semicolon-delimited list of the columns that contain NULL values.
Many data definition language (DDL) operations generate XLA updates that can be monitored by XLA event handlers. This section describes the contents of the MapMessage
objects that are generated for these operations.
Messages with __TYPE=1 (XlaConstants.CREATE_TABLE)
indicate that a table has been created. Table 6-3 shows the name/value pairs that are included in a MapMessage
generated for a CREATE_TABLE operation.
Table 6-3 CREATE_TABLE data provided in update messages
Name | Value |
---|---|
|
String value of the owner of the created table. |
|
String value of the name of the created table. |
|
String value containing the names of the columns in the primary key for this table. If the table has no primary key, the Format: |
|
String value containing the names of the columns in the table. Format: Note: For each column in the table, additional name/value pairs that describe the column are included in |
|
Integer value representing the data type of this column. From |
|
Integer value containing the precision of this column (for NUMERIC or DECIMAL). |
|
Integer value containing the scale of this column (for NUMERIC or DECIMAL). |
|
Integer value indicating the maximum size of this column (for CHAR, VARCHAR, BINARY, or VARBINARY). |
|
Boolean value indicating whether this column can have a NULL value. |
|
Boolean value indicating whether this column is stored in the "in line" or "out of line" part of the tuple. |
|
Boolean value indicating whether this column is part of the primary key of the table. |
Messages with __TYPE=2 (XlaConstants.DROP_TABLE)
indicate that a table has been dropped. Table 6-4 shows the name/value pairs that are included in a MapMessage
generated for a DROP_TABLE operation.
Messages with __TYPE=3 (XlaConstants.CREATE_INDEX)
indicate that an index has been created. Table 6-5 shows the name/value pairs that are included in a MapMessage
generated for a CREATE_INDEX operation.
Table 6-5 CREATE_INDEX data provided in update messages
Name | Value |
---|---|
|
String value of the owner of the table on which the index was created. |
|
String value of the name of the table on which the index was created. |
|
String value of the name of the created index. |
|
String value representing the index type: "P" (primary key), "F" (foreign key), or "R" (regular). |
|
String value representing the index method: "H" (hash), "T" (range), or "B" (bit map). |
|
Boolean value indicating whether the index is UNIQUE. |
|
Integer value representing the number of PAGES in a hash index (not specified for range indexes). |
|
String value describing the columns in the index. Format: |
Messages with __TYPE=4 (XlaConstants.DROP_INDEX)
indicate that an index has been dropped. Table 6-6 shows the name/value pairs that are included in a MapMessage
generated for a DROP_INDEX operation.
Messages with __TYPE=5 (XlaConstants.ADD_COLUMNS)
indicate that a table has been altered by adding new columns. Table 6-7 shows the name/value pairs that are included in a MapMessage
generated for a ADD_COLUMNS operation.
Table 6-7 ADD_COLUMNS data provided in update messages
Name | Value |
---|---|
|
String value of the owner of the altered table. |
|
String value of the name of the altered table. |
|
String value containing the names of the columns in the primary key for this table. If the table has no primary key, the PK_COLUMNS value is not specified. Format: |
|
String value containing the names of the columns added to the table. Format: Note: for each added column, additional name/value pairs that describe the column are included in the |
|
Integer value representing the data type of this column. From |
|
Integer value containing the precision of this column (for NUMERIC or DECIMAL). |
|
Integer value containing the scale of this column (for NUMERIC or DECIMAL). |
|
Integer value indicating the maximum size of this column (for CHAR, VARCHAR, BINARY, or VARBINARY). |
|
Boolean value indicating whether this column can have a NULL value. |
|
Boolean value indicating whether this column is stored in the "in line" or "out of line" part of the tuple. |
|
Boolean value indicating whether this column is part of the primary key of the table. |
Messages with __TYPE=6 (XlaConstants.DROP_COLUMNS)
indicate that a table has been altered by dropping existing columns. Table 6-8 shows the name/value pairs that are included in a MapMessage
generated for a DROP_COLUMNS operation.
Table 6-8 DROP_COLUMNS data provided in update message
Name | Value |
---|---|
|
String value of the owner of the altered table. |
|
String value of the name of the altered table. |
|
String value containing the names of the columns dropped from the table. Format: Note: for each dropped column, additional name/value pairs that describe the column are included in the |
|
Integer value representing the data type of this column. From |
|
Integer value containing the precision of this column (for NUMERIC or DECIMAL). |
|
Integer value containing the scale of this column (for NUMERIC or DECIMAL). |
|
Integer value indicating the maximum size of this column (for CHAR, VARCHAR, BINARY, or VARBINARY). |
|
Boolean value indicating whether this column can have a NULL value. |
|
Boolean value indicating whether this column is stored in the "in line" or "out of line" part of the tuple. |
|
Boolean value indicating whether this column is part of the primary key of the table. |
Messages with __TYPE=14 (XlaConstants.CREATE_VIEW)
indicate that a materialized view has been created. Table 6-9 shows the name/value pairs that are included in a MapMessage
generated for a CREATE_VIEW operation.
Messages with __TYPE=15 (XlaConstants.DROP_VIEW)
indicate that a materialized view has been dropped. Table 6-10 shows the name/value pairs that are included in a MapMessage
generated for a DROP_VIEW operation.
Messages with __TYPE=16 (XlaConstants.CREATE_SEQ)
indicate that a SEQUENCE has been created. Table 6-11 shows the name/value pairs that are included in a MapMessage
generated for a CREATE_SEQ operation.
Table 6-11 CREATE_SEQ data provided in update messages
Name | Value |
---|---|
|
String value of the owner of the created sequence. |
|
String value of the name of the created sequence. |
|
Boolean value indicating whether the CYCLE option was specified on the new sequence. |
|
Long value indicating the INCREMENT BY option specified for the new sequence. |
|
Long value indicating the MINVALUE option specified for the new sequence. |
|
Long value indicating the MAXVALUE option specified for the new sequence. |
Messages with __TYPE=17 (XlaConstants.DROP_SEQ)
indicate that a sequence has been dropped. Table 6-12 shows the name/value pairs that are included in a MapMessage
generated for a DROP_SEQ operation.
Messages with __TYPE=18(XlaConstants.TRUNCATE
) indicate that a table has been truncated. All rows in the table have been deleted. Table 6-13 shows the name/value pairs that are included in a MapMessage
generated for a TRUNCATE operation.
This section covers data type considerations for JMS/XLA.
Table 6-14 lists access methods for the data types supported by TimesTen. For more information about data types, see "Data Types" in Oracle TimesTen In-Memory Database SQL Reference.
Table 6-14 Data Type Mapping
TimesTen column type | Read with MapMessage method... |
---|---|
CHAR(n) |
|
VARCHAR(n) |
|
NCHAR(n) |
|
NVARCHAR(n) |
|
NVARCHAR2(n) |
|
DOUBLE |
|
FLOAT |
|
DECIMAL(p,s) |
Can be converted to |
NUMERIC(p,s) |
Can be converted to |
INTEGER |
|
SMALLINT |
|
TINYINT |
|
BIGINT |
|
BINARY(n) |
|
VARBINARY(n) |
|
DATE |
The Can be converted to |
TIME |
Can be converted to |
TIMESTAMP |
The Can be converted to |
TT_CHAR |
|
TT_VARCHAR |
|
TT_NCHAR |
|
TT_NVARCHAR |
|
ORA_CHAR |
|
ORA_VARCHAR2 |
|
ORA_NCHAR |
|
ORA_NVARCHAR2 |
|
VARCHAR2 |
|
TT_TINYINT |
|
TT_SMALLINT |
|
TT_INTEGER |
|
TT_BIGINT |
|
BINARY_FLOAT |
|
BINARY_DOUBLE |
|
REAL |
|
NUMBER |
|
ORA_NUMBER |
|
TT_DECIMAL |
|
TT_TIME |
|
TT_DATE |
The |
TT_TIMESTAMP |
The |
ORA_DATE |
The |
ORA_TIMESTAMP |
The |
TT_BINARY |
|
TT_VARBINARY |
|
ROWID |
|
You can use JMS classes when programming to the JMS/XLA API. The JMS/XLA API supports only publish/subscribe messaging. JMS classes include the following:
Message
(parent class only)
TopicConnectionFactory
Topic
TopicSubscriber
Connection
Session
ConnectionMetaData
MapMessage
TopicConnection
TopicSession
ConnectionFactory
Destination
MessageConsumer
ExceptionListener
See the following location for documentation of these classes:
The TimesTen com.timesten.dataserver.jmsxla
package includes the TargetDataStore
interface and the TargetDataStoreImpl
class.
See Oracle TimesTen In-Memory Database JMS/XLA Java API Reference for information.
This interface is used to apply XLA update records from a source data store to a target data store. The source and target data store schema must be identical for the affected tables.
This interface includes the methods shown in Table 6-15.
Table 6-15 TargetDataStore methods
Method | Description |
---|---|
|
Applies XLA update descriptor to the target data store. |
|
Closes the connections to the data store and releases the resources. |
|
Performs a manual commit. |
|
Returns the value of the autocommit flag. |
|
Returns the data store connection string. |
|
Returns the value of the flag for checking update conflicts. |
|
Checks whether the object is closed. |
|
Checks whether the data store is valid. |
|
Rolls back the last transaction. |
|
Sets the flag for autocommit during apply. |
|
Sets the flag for checking update conflicts during apply. |
Table 6-16 shows the JMS message header fields provided by JMS/XLA.