org.hibernate.dialect.SybaseAnywhereDialect Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core-jakarta Show documentation
Show all versions of hibernate-core-jakarta Show documentation
Hibernate O/RM implementation of the Jakarta Persistence specification
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
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
* extending Sybase (Enterprise) Dialect
* (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
*
* {@inheritDoc}
*/
@Override
public String getNoColumnsInsertString() {
return "values (default)";
}
/**
* ASA does not require to drop constraint before dropping tables, so disable it.
*
* NOTE : Also, the DROP statement syntax used by Hibernate to drop constraints is
* not compatible with ASA.
*
* {@inheritDoc}
*/
@Override
public boolean dropConstraints() {
return false;
}
@Override
public IdentityColumnSupport getIdentityColumnSupport() {
return new SybaseAnywhereIdentityColumnSupport();
}
@Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
return sqlCode == Types.BOOLEAN ? BitTypeDescriptor.INSTANCE : super.getSqlTypeDescriptorOverride( sqlCode );
}
}