|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.jdbc.sql.DBDictionary org.apache.openjpa.jdbc.sql.AbstractSQLServerDictionary org.apache.openjpa.jdbc.sql.SybaseDictionary
public class SybaseDictionary
Dictionary for Sybase.
The main point of interest is that by default, every table
that is created will have a unique column named "UNQ_INDEX" of
the "IDENTITY" type. OpenJPA will not ever utilize this column. However,
due to internal Sybase restrictions, this column is required
in order to support pessimistic (datastore) locking, since Sybase
requires that any tables in a "SELECT ... FOR UPDATE" clause have
a unique index that is not included in the list
of columns, as described in the
Sybase documentation. This behavior can be surpressed by setting the
dictionary property CreateIdentityColumn=false
. The
name of the unique column can be changed by setting the property
IdentityColumnName=COLUMN_NAME
.
A good Sybase type reference is can be found here.
Nested Class Summary | |
---|---|
protected static class |
SybaseDictionary.SybaseConnection
Connection wrapper to cache the Connection.getCatalog() result,
which takes a very long time with the Sybase Connection (and
which we frequently invoke). |
Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.sql.DBDictionary |
---|
DBDictionary.SerializedData |
Field Summary | |
---|---|
boolean |
createIdentityColumn
If true, then whenever the schematool creates a
table, it will append an additional IDENTITY column to the
table's creation SQL. |
String |
identityColumnName
If createIdentityColumn is true, then the
identityColumnName will be the name of the
additional unique column that will be created. |
boolean |
ignoreNumericTruncation
If true, Sybase will ignore numeric truncation on insert or update operations. |
Fields inherited from interface org.apache.openjpa.jdbc.sql.JoinSyntaxes |
---|
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL |
Constructor Summary | |
---|---|
SybaseDictionary()
|
Method Summary | |
---|---|
Connection |
decorate(Connection conn)
Decorate the given connection if needed. |
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object. |
String[] |
getAddForeignKeySQL(ForeignKey fk)
Return a series of SQL statements to add the given foreign key to its table. |
String[] |
getCreateTableSQL(Table table)
Return a series of SQL statements to create the given table, complete with columns. |
protected String |
getDeclareColumnSQL(Column col,
boolean alter)
Return the declaration SQL for the given column. |
String[] |
getDropColumnSQL(Column column)
Return a series of SQL statements to drop the given column from its table. |
int |
getJDBCType(int metaTypeCode,
boolean lob)
Return the preferred Types constant for the given
JavaTypes or JavaSQLTypes constant. |
protected Index |
newIndex(ResultSet idxMeta)
Create a new index from the information in the index metadata. |
protected PrimaryKey |
newPrimaryKey(ResultSet pkMeta)
Create a new primary key from the information in the schema metadata. |
void |
refSchemaComponents(Table table)
Increment the reference count of any table components that this dictionary adds that are not used by mappings. |
void |
setBigInteger(PreparedStatement stmnt,
int idx,
BigInteger val,
Column col)
Set the given value as a parameter to the statement. |
Methods inherited from class org.apache.openjpa.jdbc.sql.AbstractSQLServerDictionary |
---|
appendSelectRange, getColumns, getFullName, indexOf, setNull, substring |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean createIdentityColumn
schematool
creates a
table, it will append an additional IDENTITY column to the
table's creation SQL. This is so Sybase will be able to
perform SELECT...FOR UPDATE
statements.
public String identityColumnName
createIdentityColumn
is true, then the
identityColumnName
will be the name of the
additional unique column that will be created.
public boolean ignoreNumericTruncation
Constructor Detail |
---|
public SybaseDictionary()
Method Detail |
---|
public int getJDBCType(int metaTypeCode, boolean lob)
DBDictionary
Types
constant for the given
JavaTypes
or JavaSQLTypes
constant.
getJDBCType
in class DBDictionary
public void setBigInteger(PreparedStatement stmnt, int idx, BigInteger val, Column col) throws SQLException
DBDictionary
setBigInteger
in class DBDictionary
SQLException
public String[] getAddForeignKeySQL(ForeignKey fk)
DBDictionary
ALTER TABLE <table name> ADD
<fk cons sql >
by default.
getAddForeignKeySQL
in class DBDictionary
public String[] getCreateTableSQL(Table table)
DBDictionary
getCreateTableSQL
in class DBDictionary
protected String getDeclareColumnSQL(Column col, boolean alter)
DBDictionary
DBDictionary.getCreateTableSQL(org.apache.openjpa.jdbc.schema.Table)
and
DBDictionary.getAddColumnSQL(org.apache.openjpa.jdbc.schema.Column)
.
getDeclareColumnSQL
in class DBDictionary
public String[] getDropColumnSQL(Column column)
DBDictionary
ALTER TABLE <table name> DROP COLUMN <col name>
by default.
getDropColumnSQL
in class DBDictionary
public void refSchemaComponents(Table table)
DBDictionary
refSchemaComponents
in class DBDictionary
public void endConfiguration()
Configurable
endConfiguration
in interface Configurable
endConfiguration
in class DBDictionary
public Connection decorate(Connection conn) throws SQLException
DBDictionary
DBDictionary.initializationSQL
that has been set for the dictionary but
does not decorate the connection.
decorate
in interface ConnectionDecorator
decorate
in class DBDictionary
SQLException
protected PrimaryKey newPrimaryKey(ResultSet pkMeta) throws SQLException
newPrimaryKey
in class DBDictionary
SQLException
protected Index newIndex(ResultSet idxMeta) throws SQLException
newIndex
in class DBDictionary
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |