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;
|
package org.hibernate.dialect;
|
||||||
|
|
||||||
|
|
||||||
|
import java.sql.Types;
|
||||||
|
|
||||||
import org.hibernate.dialect.identity.IdentityColumnSupport;
|
import org.hibernate.dialect.identity.IdentityColumnSupport;
|
||||||
import org.hibernate.dialect.identity.SybaseAnywhereIdentityColumnSupport;
|
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
|
* SQL Dialect for Sybase Anywhere
|
||||||
|
@ -16,6 +20,13 @@ import org.hibernate.dialect.identity.SybaseAnywhereIdentityColumnSupport;
|
||||||
* (Tested on ASA 8.x)
|
* (Tested on ASA 8.x)
|
||||||
*/
|
*/
|
||||||
public class SybaseAnywhereDialect extends SybaseDialect {
|
public class SybaseAnywhereDialect extends SybaseDialect {
|
||||||
|
|
||||||
|
public SybaseAnywhereDialect() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
registerColumnType( Types.BOOLEAN, "bit" );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sybase Anywhere syntax would require a "DEFAULT" for each column specified,
|
* 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
|
* 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.
|
* ASA does not require to drop constraint before dropping tables, so disable it.
|
||||||
* <p/>
|
* <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.
|
* not compatible with ASA.
|
||||||
* <p/>
|
* <p/>
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -44,4 +55,9 @@ public class SybaseAnywhereDialect extends SybaseDialect {
|
||||||
public IdentityColumnSupport getIdentityColumnSupport() {
|
public IdentityColumnSupport getIdentityColumnSupport() {
|
||||||
return new SybaseAnywhereIdentityColumnSupport();
|
return new SybaseAnywhereIdentityColumnSupport();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||||
|
return sqlCode == Types.BOOLEAN ? BitTypeDescriptor.INSTANCE : super.getSqlTypeDescriptorOverride( sqlCode );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue