Switch to standard view 
  Sybase logo
 
 
 



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"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

   <session-factory>

   <property name="hibernate.connection.driver_class">ianywhere.ml.jdbcodbc.IDriver</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"/>

   </session-factory>

</hibernate-configuration>
  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 SQLAnywhere10Dialect.java 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.

 



Back to Top
© Copyright 2010, Sybase Inc.