类 Cache71Dialect
- java.lang.Object
-
- org.hibernate.dialect.Dialect
-
- org.hibernate.dialect.Cache71Dialect
-
- 所有已实现的接口:
ConversionContext
public class Cache71Dialect extends Dialect
Caché 2007.1 dialect. This class is required in order to use Hibernate with InterSystems Caché SQL. Compatible with Caché 2007.1.PREREQUISITES
These setup instructions assume that both Caché and Hibernate are installed and operational.
HIBERNATE DIRECTORIES AND FILES
JBoss distributes the InterSystems Cache' dialect for Hibernate 3.2.1 For earlier versions of Hibernate please contact InterSystems Worldwide Response Center (WRC) for the appropriate source files.
CACHÉ DOCUMENTATION
Documentation for Caché is available online when Caché is running. It can also be obtained from the InterSystems website. The book, "Object-oriented Application Development Using the Caché Post-relational Database: is also available from Springer-Verlag.
HIBERNATE DOCUMENTATION
Hibernate comes with extensive electronic documentation. In addition, several books on Hibernate are available from Manning Publications Co. Three available titles are "Hibernate Quickly", "Hibernate in Action", and "Java Persistence with Hibernate".
TO SET UP HIBERNATE FOR USE WITH CACHÉ
The following steps assume that the directory where Caché was installed is C:\CacheSys. This is the default installation directory for Caché. The default installation directory for Hibernate is assumed to be C:\Hibernate. If either product is installed in a different location, the pathnames that follow should be modified appropriately. Caché version 2007.1 and above is recommended for use with Hibernate. The next step depends on the location of your CacheDB.jar depending on your version of Caché.- Copy C:\CacheSys\dev\java\lib\JDK15\CacheDB.jar to C:\Hibernate\lib\CacheDB.jar.
- Insert the following files into your Java classpath:
- All jar files in the directory C:\Hibernate\lib
- The directory (or directories) where hibernate.properties and/or hibernate.cfg.xml are kept.
- In the file, hibernate.properties (or hibernate.cfg.xml), specify the Caché dialect and the Caché version URL settings.
NOTE: Please contact your administrator for the userid and password you should use when attempting access via JDBC. By default, these are chosen to be "_SYSTEM" and "SYS" respectively as noted in the SQL standard.Property Name Property Value hibernate.dialect org.hibernate.dialect.Cache71Dialect hibernate.connection.driver_class com.intersys.jdbc.CacheDriver hibernate.connection.username (see note 1) hibernate.connection.password (see note 1) hibernate.connection.url jdbc:Cache://127.0.0.1:1972/USER
CACHÉ VERSION URL
This is the standard URL for the JDBC driver. For a JDBC driver on the machine hosting Caché, use the IP "loopback" address, 127.0.0.1. For 1972, the default port, specify the super server port of your Caché instance. For USER, substitute the NAMESPACE which contains your Caché database data.
CACHÉ DIALECTS
Choices for Dialect are:
- org.hibernate.dialect.Cache71Dialect (requires Caché 2007.1 or above)
SUPPORT FOR IDENTITY COLUMNS
Caché 2007.1 or later supports identity columns. For Hibernate to use identity columns, specify "native" as the generator.
SEQUENCE DIALECTS SUPPORT SEQUENCES
To use Hibernate sequence support with Caché in a namespace, you must FIRST load the following file into that namespace:etc\CacheSequences.xmlFor example, at the COS terminal prompt in the namespace, run the following command:d LoadFile^%apiOBJ("c:\hibernate\etc\CacheSequences.xml","ck")
In your Hibernate mapping you can specify sequence use.
For example, the following shows the use of a sequence generator in a Hibernate mapping:
<id name="id" column="uid" type="long" unsaved-value="null"> <generator class="sequence"/> </id>
Some versions of Hibernate under some circumstances call getSelectSequenceNextValString() in the dialect. If this happens you will receive the error message: new MappingException( "Dialect does not support sequences" ).
HIBERNATE FILES ASSOCIATED WITH CACHÉ DIALECT
The following files are associated with Caché dialect:- src\org\hibernate\dialect\Cache71Dialect.java
- src\org\hibernate\dialect\function\ConditionalParenthesisFunction.java
- src\org\hibernate\dialect\function\ConvertFunction.java
- src\org\hibernate\exception\CacheSQLStateConverter.java
- src\org\hibernate\sql\CacheJoinFragment.java
- 作者:
- Jonathan Levinson
-
-
字段概要
字段 修饰符和类型 字段 说明 static ViolatedConstraintNameExtracterEXTRACTERThe Cache ViolatedConstraintNameExtracter.
-
构造器概要
构造器 构造器 说明 Cache71Dialect()Creates newCache71Dialectinstance.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanareStringComparisonsCaseInsensitive()Are string comparisons implicitly case insensitive.booleanbindLimitParametersFirst()Does the LIMIT clause come at the start of the SELECT statement, rather than at the end?SQLExceptionConversionDelegatebuildSQLExceptionConversionDelegate()Build an instance of aSQLExceptionConversionDelegatefor interpreting dialect-specific error or SQLState codes.protected voidcommonRegistration()JoinFragmentcreateOuterJoinFragment()Create aJoinFragmentstrategy responsible for handling this dialect's variations in how joins are handled.booleandropConstraints()Do we need to drop constraints before dropping tables in this dialect?StringgetAddColumnString()The syntax used to add a column to a table (optional).StringgetAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey)The syntax used to add a foreign key constraint to a table.StringgetCascadeConstraintsString()Completely optional cascading drop clauseMultiTableBulkIdStrategygetDefaultMultiTableBulkIdStrategy()IdentityColumnSupportgetIdentityColumnSupport()Get the appropriateIdentityColumnSupportLimitHandlergetLimitHandler()Returns the delegate managing LIMIT clause.StringgetLimitString(String sql, boolean hasOffset)Apply a limit clause to the query.LockingStrategygetLockingStrategy(Lockable lockable, LockMode lockMode)Get a strategy instance which knows how to acquire a database-level lock of the specified mode for this dialect.StringgetLowercaseFunction()The name of the SQL function that transforms a string to lowercaseStringgetNativeIdentifierGeneratorStrategy()Resolves the native generation strategy associated to this dialect.StringgetNoColumnsInsertString()The fragment used to insert a row without specifying any column values.StringgetNullColumnString()The keyword used to specify a nullable column.ResultSetgetResultSet(CallableStatement ps)Given a callable statement previously processed byDialect.registerResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSetfrom the OUT parameter.ViolatedConstraintNameExtractergetViolatedConstraintNameExtracter()booleanhasAlterTable()Does this dialect support the ALTER TABLE syntax?booleanhasSelfReferentialForeignKeyBug()Does the database/driver have bug in deleting rows that refer to other rows being deleted in the same query?booleanqualifyIndexName()Do we need to qualify index names with the schema name?protected voidregister71Functions()intregisterResultSetOutParameter(CallableStatement statement, int col)Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet*by position*.booleansupportsCascadeDelete()Does this dialect support cascaded delete on foreign key definitions?booleansupportsCheck()Does this dialect support check constraints?booleansupportsEmptyInList()Does this dialect support empty IN lists?booleansupportsLimit()Does this dialect support some form of limiting query results via a SQL clause?booleansupportsLimitOffset()Does this dialect's LIMIT support (if any) additionally support specifying an offset?booleansupportsOuterJoinForUpdate()Does this dialect support FOR UPDATE in conjunction with outer joined rows?booleansupportsResultSetPositionQueryMethodsOnForwardOnlyCursor()Does this dialect support asking the result set its positioning information on forward only cursors.booleansupportsSequences()Does this dialect support sequences?booleansupportsVariableLimit()Does this dialect support bind variables (i.e., prepared statement parameters) for its limit/offset?booleanuseMaxForLimit()Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows?-
从类继承的方法 org.hibernate.dialect.Dialect
addSqlHintOrComment, appendLockHint, appendLockHint, applyLocksToSql, augmentRecognizedTableTypes, bindLimitParametersInReverseOrder, buildIdentifierHelper, buildSQLExceptionConverter, canCreateCatalog, canCreateSchema, cast, cast, cast, closeQuote, contributeTypes, convertToFirstRowValue, createCaseFragment, defaultScrollMode, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, escapeLiteral, forceLimitUsage, forceLobAsLastValue, forUpdateOfColumns, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAddUniqueConstraintString, getAlterTableString, getAuxiliaryDatabaseObjectExporter, getCallableStatementSupport, getCaseInsensitiveLike, getCastTypeName, getColumnAliasExtractor, getColumnComment, getCreateCatalogCommand, getCreateMultisetTableString, getCreateSchemaCommand, getCreateSequenceString, getCreateSequenceString, getCreateSequenceStrings, getCreateSequenceStrings, getCreateTableString, getCrossJoinSeparator, getCurrentSchemaCommand, getCurrentTimestampSelectString, getCurrentTimestampSQLFunctionName, getDefaultBatchLoadSizingStrategy, getDefaultProperties, getDialect, getDialect, getDropCatalogCommand, getDropForeignKeyString, getDropSchemaCommand, getDropSequenceString, getDropSequenceStrings, getDropTableString, getForeignKeyExporter, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateSkipLockedString, getForUpdateSkipLockedString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getFunctions, getHibernateTypeName, getHibernateTypeName, getIndexExporter, getInExpressionCountLimit, getKeywords, getLimitString, getLobMergeStrategy, getMaxAliasLength, getNameQualifierSupport, getNativeIdentifierGeneratorClass, getNotExpression, getQueryHintString, getQueryHintString, getQuerySequencesString, getReadLockString, getReadLockString, getResultSet, getResultSet, getSchemaNameResolver, getSelectClauseNullString, getSelectGUIDString, getSelectSequenceNextValString, getSequenceExporter, getSequenceInformationExtractor, getSequenceNextValString, getSqlTypeDescriptorOverride, getTableComment, getTableExporter, getTableTypeString, getTypeName, getTypeName, getUniqueDelegate, getUniqueKeyExporter, getWriteLockString, getWriteLockString, inlineLiteral, isCurrentTimestampSelectStringCallable, isJdbcLogWarningsEnabledByDefault, isLegacyLimitHandlerBehaviorEnabled, isLockTimeoutParameterized, isTypeNameRegistered, openQuote, prependComment, quote, registerColumnType, registerColumnType, registerFunction, registerHibernateType, registerHibernateType, registerKeyword, registerResultSetOutParameter, remapSqlTypeDescriptor, renderOrderByElement, replaceResultVariableInOrderByClauseWithPosition, requiresCastingOfParametersInSelectClause, requiresParensForTupleDistinctCounts, supportsBindAsCallableArgument, supportsCaseInsensitiveLike, supportsCircularCascadeDeleteConstraints, supportsColumnCheck, supportsCommentOn, supportsCurrentTimestampSelection, supportsExistsInSelect, supportsExpectedLobUsagePattern, supportsIfExistsAfterAlterTable, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsBeforeConstraintName, supportsIfExistsBeforeTableName, supportsJdbcConnectionLobCreation, supportsLobValueChangePropogation, supportsLockTimeouts, supportsNamedParameters, supportsNationalizedTypes, supportsNoColumnsInsert, supportsNonQueryWithCTE, supportsNotNullUnique, supportsNoWait, supportsParametersInInsertSelect, supportsPartitionBy, supportsPooledSequences, supportsRowValueConstructorSyntax, supportsRowValueConstructorSyntaxInInList, supportsSelectAliasInGroupByClause, supportsSkipLocked, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTupleCounts, supportsTupleDistinctCounts, supportsTuplesInSubqueries, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnique, supportsUniqueConstraintInCreateAlterTable, supportsValuesList, toBooleanValueString, toString, transformSelectString, useFollowOnLocking, useFollowOnLocking, useInputStreamToInsertBlob
-
-
-
-
字段详细资料
-
EXTRACTER
public static final ViolatedConstraintNameExtracter EXTRACTER
The Cache ViolatedConstraintNameExtracter.
-
-
方法详细资料
-
commonRegistration
protected final void commonRegistration()
-
register71Functions
protected final void register71Functions()
-
hasAlterTable
public boolean hasAlterTable()
从类复制的说明:DialectDoes this dialect support the ALTER TABLE syntax?- 覆盖:
hasAlterTable在类中Dialect- 返回:
- True if we support altering of tables; false otherwise.
-
qualifyIndexName
public boolean qualifyIndexName()
从类复制的说明:DialectDo we need to qualify index names with the schema name?- 覆盖:
qualifyIndexName在类中Dialect- 返回:
- boolean
-
getAddForeignKeyConstraintString
public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey)
从类复制的说明:DialectThe syntax used to add a foreign key constraint to a table.- 覆盖:
getAddForeignKeyConstraintString在类中Dialect- 参数:
constraintName- The FK constraint name.foreignKey- The names of the columns comprising the FKreferencedTable- The table referenced by the FKprimaryKey- The explicit columns in the referencedTable referenced by this FK.referencesPrimaryKey- if false, constraint should be explicit about which column names the constraint refers to- 返回:
- the "add FK" fragment
-
supportsCheck
public boolean supportsCheck()
Does this dialect support check constraints?- 返回:
false(Cache does not support check constraints)
-
getAddColumnString
public String getAddColumnString()
从类复制的说明:DialectThe syntax used to add a column to a table (optional).- 覆盖:
getAddColumnString在类中Dialect- 返回:
- The "add column" fragment.
-
getCascadeConstraintsString
public String getCascadeConstraintsString()
从类复制的说明:DialectCompletely optional cascading drop clause- 覆盖:
getCascadeConstraintsString在类中Dialect- 返回:
- String
-
dropConstraints
public boolean dropConstraints()
从类复制的说明:DialectDo we need to drop constraints before dropping tables in this dialect?- 覆盖:
dropConstraints在类中Dialect- 返回:
- True if constraints must be dropped prior to dropping the table; false otherwise.
-
supportsCascadeDelete
public boolean supportsCascadeDelete()
从类复制的说明:DialectDoes this dialect support cascaded delete on foreign key definitions?- 覆盖:
supportsCascadeDelete在类中Dialect- 返回:
trueindicates that the dialect does support cascaded delete on foreign keys.
-
hasSelfReferentialForeignKeyBug
public boolean hasSelfReferentialForeignKeyBug()
从类复制的说明:DialectDoes the database/driver have bug in deleting rows that refer to other rows being deleted in the same query?- 覆盖:
hasSelfReferentialForeignKeyBug在类中Dialect- 返回:
trueif the database/driver has this bug
-
getDefaultMultiTableBulkIdStrategy
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy()
-
getNativeIdentifierGeneratorStrategy
public String getNativeIdentifierGeneratorStrategy()
从类复制的说明:DialectResolves the native generation strategy associated to this dialect. Comes into play whenever the user specifies the native generator.- 覆盖:
getNativeIdentifierGeneratorStrategy在类中Dialect- 返回:
- The native generator strategy.
-
getIdentityColumnSupport
public IdentityColumnSupport getIdentityColumnSupport()
从类复制的说明:DialectGet the appropriateIdentityColumnSupport- 覆盖:
getIdentityColumnSupport在类中Dialect- 返回:
- the IdentityColumnSupport
-
supportsSequences
public boolean supportsSequences()
从类复制的说明:DialectDoes this dialect support sequences?- 覆盖:
supportsSequences在类中Dialect- 返回:
- True if sequences supported; false otherwise.
-
supportsOuterJoinForUpdate
public boolean supportsOuterJoinForUpdate()
从类复制的说明:DialectDoes this dialect support FOR UPDATE in conjunction with outer joined rows?- 覆盖:
supportsOuterJoinForUpdate在类中Dialect- 返回:
- True if outer joined rows can be locked via FOR UPDATE.
-
getLockingStrategy
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode)
从类复制的说明:DialectGet a strategy instance which knows how to acquire a database-level lock of the specified mode for this dialect.- 覆盖:
getLockingStrategy在类中Dialect- 参数:
lockable- The persister for the entity to be locked.lockMode- The type of lock to be acquired.- 返回:
- The appropriate locking strategy.
-
getLimitHandler
public LimitHandler getLimitHandler()
从类复制的说明:DialectReturns the delegate managing LIMIT clause.- 覆盖:
getLimitHandler在类中Dialect- 返回:
- LIMIT clause delegate.
-
supportsLimit
public boolean supportsLimit()
从类复制的说明:DialectDoes this dialect support some form of limiting query results via a SQL clause?- 覆盖:
supportsLimit在类中Dialect- 返回:
- True if this dialect supports some form of LIMIT.
-
supportsLimitOffset
public boolean supportsLimitOffset()
从类复制的说明:DialectDoes this dialect's LIMIT support (if any) additionally support specifying an offset?- 覆盖:
supportsLimitOffset在类中Dialect- 返回:
- True if the dialect supports an offset within the limit support.
-
supportsVariableLimit
public boolean supportsVariableLimit()
从类复制的说明:DialectDoes this dialect support bind variables (i.e., prepared statement parameters) for its limit/offset?- 覆盖:
supportsVariableLimit在类中Dialect- 返回:
- True if bind variables can be used; false otherwise.
-
bindLimitParametersFirst
public boolean bindLimitParametersFirst()
从类复制的说明:DialectDoes the LIMIT clause come at the start of the SELECT statement, rather than at the end?- 覆盖:
bindLimitParametersFirst在类中Dialect- 返回:
- true if limit parameters should come before other parameters
-
useMaxForLimit
public boolean useMaxForLimit()
从类复制的说明:DialectDoes the LIMIT clause take a "maximum" row number instead of a total number of returned rows? This is easiest understood via an example. Consider you have a table with 20 rows, but you only want to retrieve rows number 11 through 20. Generally, a limit with offset would say that the offset = 11 and the limit = 10 (we only want 10 rows at a time); this is specifying the total number of returned rows. Some dialects require that we instead specify offset = 11 and limit = 20, where 20 is the "last" row we want relative to offset (i.e. total number of rows = 20 - 11 = 9) So essentially, is limit relative from offset? Or is limit absolute?- 覆盖:
useMaxForLimit在类中Dialect- 返回:
- True if limit is relative from offset; false otherwise.
-
getLimitString
public String getLimitString(String sql, boolean hasOffset)
从类复制的说明:DialectApply a limit clause to the query. Typically dialects utilizevariablelimit clauses when they support limits. Thus, when building the select command we do not actually need to know the limit or the offset since we will just be using placeholders. Here we do still pass along whether or not an offset was specified so that dialects not supporting offsets can generate proper exceptions. In general, dialects will override one or the other of this method andDialect.getLimitString(String, int, int).- 覆盖:
getLimitString在类中Dialect- 参数:
sql- The query to which to apply the limit.hasOffset- Is the query requesting an offset?- 返回:
- the modified SQL
-
registerResultSetOutParameter
public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException
从类复制的说明:DialectRegisters a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet*by position*. Pre-Java 8, registering such ResultSet-returning parameters varied greatly across database and drivers; hence its inclusion as part of the Dialect contract.- 覆盖:
registerResultSetOutParameter在类中Dialect- 参数:
statement- The callable statement.col- The bind position at which to register the output param.- 返回:
- The number of (contiguous) bind positions used.
- 抛出:
SQLException- Indicates problems registering the param.
-
getResultSet
public ResultSet getResultSet(CallableStatement ps) throws SQLException
从类复制的说明:DialectGiven a callable statement previously processed byDialect.registerResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSetfrom the OUT parameter.- 覆盖:
getResultSet在类中Dialect- 参数:
ps- The callable statement.- 返回:
- The extracted result set.
- 抛出:
SQLException- Indicates problems extracting the result set.
-
getLowercaseFunction
public String getLowercaseFunction()
从类复制的说明:DialectThe name of the SQL function that transforms a string to lowercase- 覆盖:
getLowercaseFunction在类中Dialect- 返回:
- The dialect-specific lowercase function.
-
getNullColumnString
public String getNullColumnString()
从类复制的说明:DialectThe keyword used to specify a nullable column.- 覆盖:
getNullColumnString在类中Dialect- 返回:
- String
-
createOuterJoinFragment
public JoinFragment createOuterJoinFragment()
从类复制的说明:DialectCreate aJoinFragmentstrategy responsible for handling this dialect's variations in how joins are handled.- 覆盖:
createOuterJoinFragment在类中Dialect- 返回:
- This dialect's
JoinFragmentstrategy.
-
getNoColumnsInsertString
public String getNoColumnsInsertString()
从类复制的说明:DialectThe fragment used to insert a row without specifying any column values. This is not possible on some databases.- 覆盖:
getNoColumnsInsertString在类中Dialect- 返回:
- The appropriate empty values clause.
-
buildSQLExceptionConversionDelegate
public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate()
从类复制的说明:DialectBuild an instance of aSQLExceptionConversionDelegatefor interpreting dialect-specific error or SQLState codes. WhenDialect.buildSQLExceptionConverter()returns null, the defaultSQLExceptionConverteris used to interpret SQLState and error codes. If this method is overridden to return a non-null value, the defaultSQLExceptionConverterwill use the returnedSQLExceptionConversionDelegatein addition to the following standard delegates:- a "static" delegate based on the JDBC 4 defined SQLException hierarchy;
- a delegate that interprets SQLState codes for either X/Open or SQL-2003 codes, depending on java.sql.DatabaseMetaData#getSQLStateType
- 覆盖:
buildSQLExceptionConversionDelegate在类中Dialect- 返回:
- The SQLExceptionConversionDelegate for this dialect
-
getViolatedConstraintNameExtracter
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter()
-
supportsEmptyInList
public boolean supportsEmptyInList()
从类复制的说明:DialectDoes this dialect support empty IN lists? For example, is [where XYZ in ()] a supported construct?- 覆盖:
supportsEmptyInList在类中Dialect- 返回:
- True if empty in lists are supported; false otherwise.
-
areStringComparisonsCaseInsensitive
public boolean areStringComparisonsCaseInsensitive()
从类复制的说明:DialectAre string comparisons implicitly case insensitive. In other words, does [where 'XYZ' = 'xyz'] resolve to true?- 覆盖:
areStringComparisonsCaseInsensitive在类中Dialect- 返回:
- True if comparisons are case insensitive.
-
supportsResultSetPositionQueryMethodsOnForwardOnlyCursor
public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor()
从类复制的说明:DialectDoes this dialect support asking the result set its positioning information on forward only cursors. Specifically, in the case of scrolling fetches, Hibernate needs to useResultSet.isAfterLast()andResultSet.isBeforeFirst(). Certain drivers do not allow access to these methods for forward only cursors. NOTE : this is highly driver dependent!- 覆盖:
supportsResultSetPositionQueryMethodsOnForwardOnlyCursor在类中Dialect- 返回:
- True if methods like
ResultSet.isAfterLast()andResultSet.isBeforeFirst()are supported for forward only cursors; false otherwise.
-
-