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é.
For example, in Hibernate 3.2, typical entries in hibernate.properties would have the following "name=value" pairs:
| 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 |
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.
To use Hibernate sequence support with Caché in a namespace, you must FIRST load the following file into that namespace:
etc\CacheSequences.xml
For 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" ).
| Modifier and Type | Field and Description |
|---|---|
| public static final ViolatedConstraintNameExtracter | EXTRACTER
The Cache ViolatedConstraintNameExtracter.
|
| private LimitHandler |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | areStringComparisonsCaseInsensitive()
Overrides org. |
| public boolean | bindLimitParametersFirst()
Overrides org. |
| public SQLExceptionConversionDelegate | buildSQLExceptionConversionDelegate()
Overrides org. SQLExceptionConversionDelegate for
interpreting dialect-specific error or SQLState codes.
|
| protected final void | |
| public JoinFragment | createOuterJoinFragment()
Overrides org. JoinFragment strategy responsible
for handling this dialect's variations in how joins are handled.
|
| public boolean | dropConstraints()
Do we need to drop constraints before dropping tables in this dialect?
|
| public String | getAddColumnString()
The syntax used to add a column to a table (optional).
|
| public String | getAddForeignKeyConstraintString(String
The FK constraint name. constraintName, String[] The names of the columns comprising the FK foreignKey, String The table referenced by the FK referencedTable, String[] The explicit columns in the referencedTable referenced
by this FK. primaryKey, boolean if false, constraint should be
explicit about which column names the constraint refers to referencesPrimaryKey)Overrides org. |
| public String | getCascadeConstraintsString()
Overrides org. |
| public MultiTableBulkIdStrategy | |
| public IdentityColumnSupport | getIdentityColumnSupport()
Overrides org. IdentityColumnSupport
|
| public LimitHandler | getLimitHandler()
Returns the delegate managing LIMIT clause.
|
| public String | getLimitString(String
The query to which to apply the limit. sql, boolean Is the query requesting an offset? hasOffset)Overrides org. |
| public LockingStrategy | getLockingStrategy(Lockable
The persister for the entity to be locked. lockable, LockMode The type of lock to be acquired. lockMode)
Get a strategy instance which knows how to acquire a database-level lock
of the specified mode for this dialect.
|
| public String | getLowercaseFunction()
Overrides org. |
| public String | getNativeIdentifierGeneratorStrategy()
Overrides org. |
| public String | getNoColumnsInsertString()
Overrides org. |
| public String | getNullColumnString()
Overrides org. |
| public ResultSet | getResultSet(CallableStatement
The callable statement. ps)Overrides org. registerResultSetOutParameter,
extract the ResultSet from the OUT parameter.
|
| public ViolatedConstraintNameExtracter | |
| public boolean | hasAlterTable()
Overrides org. |
| public boolean | hasSelfReferentialForeignKeyBug()
Overrides org. |
| public boolean | qualifyIndexName()
Do we need to qualify index names with the schema name?
|
| protected final void | |
| public int | registerResultSetOutParameter(CallableStatement
The callable statement. statement, int The bind position at which to register the output param. col)Overrides org. ResultSet *by position*.
|
| public boolean | supportsCascadeDelete()
Overrides org. |
| public boolean | Returns: false (Cache does not support check constraints)Does this dialect support check constraints? |
| public boolean | supportsEmptyInList()
Overrides org. |
| public boolean | supportsLimit()
Overrides org. |
| public boolean | supportsLimitOffset()
Overrides org. |
| public boolean | supportsOuterJoinForUpdate()
Overrides org. |
| public boolean | supportsResultSetPositionQueryMethodsOnForwardOnlyCursor()
Overrides org. |
| public boolean | supportsSequences()
Does this dialect support sequences?
|
| public boolean | supportsVariableLimit()
Overrides org. |
| public boolean | useMaxForLimit()
Overrides org. |
| EXTRACTER | back to summary |
|---|---|
| public static final ViolatedConstraintNameExtracter EXTRACTER Hides org. The Cache ViolatedConstraintNameExtracter. | |
| limitHandler | back to summary |
|---|---|
| private LimitHandler limitHandler | |
| Cache71Dialect | back to summary |
|---|---|
| public Cache71Dialect() Creates new | |
| areStringComparisonsCaseInsensitive | back to summary |
|---|---|
| public boolean areStringComparisonsCaseInsensitive() Overrides org. Doc from org. Are string comparisons implicitly case insensitive. In other words, does [where 'XYZ' = 'xyz'] resolve to true?
| |
| bindLimitParametersFirst | back to summary |
|---|---|
| public boolean bindLimitParametersFirst() Overrides org. Doc from org. Does the LIMIT clause come at the start of the SELECT statement, rather than at the end?
| |
| buildSQLExceptionConversionDelegate | back to summary |
|---|---|
| public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() Overrides org. Doc from org. Build an instance of a
When
It is strongly recommended that specific Dialect implementations override this method, since interpretation of a SQL error is much more accurate when based on the vendor-specific ErrorCode rather than the SQLState. Specific Dialects may override to return whatever is most appropriate for that vendor.
| |
| commonRegistration | back to summary |
|---|---|
| protected final void commonRegistration() | |
| createOuterJoinFragment | back to summary |
|---|---|
| public JoinFragment createOuterJoinFragment() Overrides org. Doc from org. Create a
| |
| dropConstraints | back to summary |
|---|---|
| public boolean dropConstraints() Overrides org. Doc from org. Do we need to drop constraints before dropping tables in this dialect?
| |
| getAddColumnString | back to summary |
|---|---|
| public String getAddColumnString() Overrides org. Doc from org. The syntax used to add a column to a table (optional). | |
| getAddForeignKeyConstraintString | back to summary |
|---|---|
| public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey) Overrides org. Doc from org. The syntax used to add a foreign key constraint to a table.
| |
| getCascadeConstraintsString | back to summary |
|---|---|
| public String getCascadeConstraintsString() Overrides org. Doc from org. Completely optional cascading drop clause | |
| getDefaultMultiTableBulkIdStrategy | back to summary |
|---|---|
| public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() Overrides org.
| |
| getIdentityColumnSupport | back to summary |
|---|---|
| public IdentityColumnSupport getIdentityColumnSupport() Overrides org. Doc from org. Get the appropriate
| |
| getLimitHandler | back to summary |
|---|---|
| public LimitHandler getLimitHandler() Overrides org. Doc from org. Returns the delegate managing LIMIT clause.
| |
| getLimitString | back to summary |
|---|---|
| public String getLimitString(String sql, boolean hasOffset) Overrides org. Doc from org. Apply a limit clause to the query.
Typically dialects utilize
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 and
| |
| getLockingStrategy | back to summary |
|---|---|
| public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) Overrides org. Doc from org. Get a strategy instance which knows how to acquire a database-level lock of the specified mode for this dialect.
| |
| getLowercaseFunction | back to summary |
|---|---|
| public String getLowercaseFunction() Overrides org. Doc from org. The name of the SQL function that transforms a string to lowercase | |
| getNativeIdentifierGeneratorStrategy | back to summary |
|---|---|
| public String getNativeIdentifierGeneratorStrategy() Overrides org. Doc from org. Resolves the native generation strategy associated to this dialect. Comes into play whenever the user specifies the native generator. | |
| getNoColumnsInsertString | back to summary |
|---|---|
| public String getNoColumnsInsertString() Overrides org. Doc from org. The fragment used to insert a row without specifying any column values. This is not possible on some databases. | |
| getNullColumnString | back to summary |
|---|---|
| public String getNullColumnString() Overrides org. Doc from org. The keyword used to specify a nullable column. | |
| getResultSet | back to summary |
|---|---|
| public ResultSet getResultSet(CallableStatement ps) throws SQLException Overrides org. Doc from org. Given a callable statement previously processed by
| |
| getViolatedConstraintNameExtracter | back to summary |
|---|---|
| public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() Overrides org. Implements org.
| |
| hasAlterTable | back to summary |
|---|---|
| public boolean hasAlterTable() Overrides org. Doc from org. Does this dialect support the ALTER TABLE syntax?
| |
| hasSelfReferentialForeignKeyBug | back to summary |
|---|---|
| public boolean hasSelfReferentialForeignKeyBug() Overrides org. Doc from org. Does the database/driver have bug in deleting rows that refer to other rows being deleted in the same query?
| |
| qualifyIndexName | back to summary |
|---|---|
| public boolean qualifyIndexName() Overrides org. Doc from org. Do we need to qualify index names with the schema name?
| |
| register71Functions | back to summary |
|---|---|
| protected final void register71Functions() | |
| registerResultSetOutParameter | back to summary |
|---|---|
| public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException Overrides org. Doc from org. Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of
returning
| |
| supportsCascadeDelete | back to summary |
|---|---|
| public boolean supportsCascadeDelete() Overrides org. Doc from org. Does this dialect support cascaded delete on foreign key definitions?
| |
| supportsCheck | back to summary |
|---|---|
| public boolean supportsCheck() Does this dialect support check constraints?
| |
| supportsEmptyInList | back to summary |
|---|---|
| public boolean supportsEmptyInList() Overrides org. Doc from org. Does this dialect support empty IN lists? For example, is [where XYZ in ()] a supported construct?
| |
| supportsLimit | back to summary |
|---|---|
| public boolean supportsLimit() Overrides org. Doc from org. Does this dialect support some form of limiting query results via a SQL clause?
| |
| supportsLimitOffset | back to summary |
|---|---|
| public boolean supportsLimitOffset() Overrides org. Doc from org. Does this dialect's LIMIT support (if any) additionally support specifying an offset?
| |
| supportsOuterJoinForUpdate | back to summary |
|---|---|
| public boolean supportsOuterJoinForUpdate() Overrides org. Doc from org. Does this dialect support FOR UPDATE in conjunction with outer joined rows?
| |
| supportsResultSetPositionQueryMethodsOnForwardOnlyCursor | back to summary |
|---|---|
| public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() Overrides org. Doc from org. Does this dialect support asking the result set its positioning
information on forward only cursors. Specifically, in the case of
scrolling fetches, Hibernate needs to use
NOTE : this is highly driver dependent!
| |
| supportsSequences | back to summary |
|---|---|
| public boolean supportsSequences() Overrides org. Doc from org. Does this dialect support sequences?
| |
| supportsVariableLimit | back to summary |
|---|---|
| public boolean supportsVariableLimit() Overrides org. Doc from org. Does this dialect support bind variables (i.e., prepared statement parameters) for its limit/offset?
| |
| useMaxForLimit | back to summary |
|---|---|
| public boolean useMaxForLimit() Overrides org. Doc from org. Does 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?
| |