Sybase Business Intelligence Solutions - Database Management, Data Warehousing Software, Mobile Enterprise Applications and Messaging
Sybase Brand Color Bar

Search for    in all of
view all search results right arrow

Downloads > Code Samples & Utilities > Hibernate Dialect for SQL Anywhere

Hibernate Dialect for SQL Anywhere
RSS Feed

This dialect for SQL Anywhere 10 or 11 is BETA software and is intended for inclusion in the JBoss Hibernate open-source distribution and licensed under LGPL.

Click here to download this dialect. Please refer to the readme file inside the compressed archive for complete install and usage instructions.

To use the new dialect:

  1. Unzip the archive
  2. Place SQLAnywhereDialect.jar in your CLASSPATH
  3. Edit the file cfg.xml for your Hibernate application to specify the usage of the new dialect. As an example, to use the iAnywhere JDBC driver with this new dialect:
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"



   <property name="hibernate.connection.driver_class"></property>

   <property name="hibernate.connection.url">jdbc:ianywhere:driver=sql anywhere 11;dbn=DATABASENAME;eng=SERVERNAME;links=sharedmemory</property>

   <property name="hibernate.connection.username">dba</property>
   <property name="hibernate.connection.password">sql</property>
   <property name="hibernate.connection.pool_size">10</property>
   <property name="dialect">org.hibernate.dialect.SQLAnywhere11Dialect</property>
   <mapping resource="RESOURCEMAPPINGFILE.xml"/>


  1. To use the dialect with JConnect, substitute the appropriate lines in the hibernate-configuration file above with:
<property name="hibernate.connection.driver_class">com.sybase.jdbc3.jdbc.SybDriver</property>
<property name="hibernate.connection.url">jdbc:sybase:Tds:localhost:2638</property>
  1. Both the SQLAnywhere10Dialect and SQLAnywhere11Dialect support ANSI isolation levels and not snapshot isolation. To use snapshot isolation:
  1. copy the file into the Hibernate source directory for dialects (typically hibernate3.x/src/org/hibernate/dialect)
  2. create a new dialect that subclasses SQLAnywhere10Dialect
  3. overload the following two methods:
public boolean doesReadCommittedCauseWritersToBlockReaders() {
    return false; // assume applications are using snapshot isolation

public boolean doesRepeatableReadCauseReadersToBlockWriters() {
    return false; // assume applications are using snapshot isolation
  1. change the PUBLIC or USER settings of the isolation_level connection option to one of SQL Anywhere's supported SNAPSHOT isolation levels. This is necessary because Hibernate config files only support 0-3 as isolation levels.



Last Revised: Aug 28, 2008
Product: SQL Anywhere
Technical Topics: Java, SQL Anywhere, Application Servers, Application Development
Business or Technical: Technical
Content Id: 1057826
Infotype: Download

© Copyright 2014, Sybase Inc. - v 7.6 Home / Contact Us / Help / Jobs / Legal / Privacy / Code of Ethics