HHH-12850 Sybase Anywhere - Explicitly map Java booleans to SQL bits
This commit is contained in:
parent
ea42f43881
commit
e4c964fb36
|
@ -7,8 +7,12 @@
|
|||
package org.hibernate.dialect;
|
||||
|
||||
|
||||
import java.sql.Types;
|
||||
|
||||
import org.hibernate.dialect.identity.IdentityColumnSupport;
|
||||
import org.hibernate.dialect.identity.SybaseAnywhereIdentityColumnSupport;
|
||||
import org.hibernate.type.descriptor.sql.BitTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
|
||||
/**
|
||||
* SQL Dialect for Sybase Anywhere
|
||||
|
@ -16,6 +20,13 @@ import org.hibernate.dialect.identity.SybaseAnywhereIdentityColumnSupport;
|
|||
* (Tested on ASA 8.x)
|
||||
*/
|
||||
public class SybaseAnywhereDialect extends SybaseDialect {
|
||||
|
||||
public SybaseAnywhereDialect() {
|
||||
super();
|
||||
|
||||
registerColumnType( Types.BOOLEAN, "bit" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sybase Anywhere syntax would require a "DEFAULT" for each column specified,
|
||||
* but I suppose Hibernate use this syntax only with tables with just 1 column
|
||||
|
@ -30,7 +41,7 @@ public class SybaseAnywhereDialect extends SybaseDialect {
|
|||
/**
|
||||
* ASA does not require to drop constraint before dropping tables, so disable it.
|
||||
* <p/>
|
||||
* NOTE : Also, the DROP statement syntax used by Hibernate to drop constraints is
|
||||
* NOTE : Also, the DROP statement syntax used by Hibernate to drop constraints is
|
||||
* not compatible with ASA.
|
||||
* <p/>
|
||||
* {@inheritDoc}
|
||||
|
@ -44,4 +55,9 @@ public class SybaseAnywhereDialect extends SybaseDialect {
|
|||
public IdentityColumnSupport getIdentityColumnSupport() {
|
||||
return new SybaseAnywhereIdentityColumnSupport();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
return sqlCode == Types.BOOLEAN ? BitTypeDescriptor.INSTANCE : super.getSqlTypeDescriptorOverride( sqlCode );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue