All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.dialect.SybaseAnywhereDialect Maven / Gradle / Ivy

There is a newer version: 6.5.0.CR2
Show newest version
/*
 * 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 ); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy