Java Code Examples for org.hibernate.dialect.Dialect#getTypeName()

The following examples show how to use org.hibernate.dialect.Dialect#getTypeName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableGenerator.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String[] sqlCreateStrings(Dialect dialect) throws HibernateException {
	return new String[] {
			dialect.getCreateTableString() + ' ' + renderedTableName + " ( "
					+ segmentColumnName + ' ' + dialect.getTypeName( Types.VARCHAR, segmentValueLength, 0, 0 ) + " not null "
					+ ", " + valueColumnName + ' ' + dialect.getTypeName( Types.BIGINT )
					+ ", primary key ( " + segmentColumnName + " ) )" + dialect.getTableTypeString()
	};
}
 
Example 2
Source File: TableStructure.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String[] sqlCreateStrings(Dialect dialect) throws HibernateException {
	return new String[] {
			dialect.getCreateTableString() + " " + tableNameText + " ( " + valueColumnNameText + " " + dialect.getTypeName( Types.BIGINT ) + " )",
			"insert into " + tableNameText + " values ( " + initialValue + " )"
	};
}
 
Example 3
Source File: MultipleHiLoPerTableGenerator.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public String[] sqlCreateStrings(Dialect dialect) throws HibernateException {
	return new String[] {
			dialect.getCreateTableString()
					+ ' ' + tableName + " ( "
					+ segmentColumnName + ' ' + dialect.getTypeName( Types.VARCHAR, keySize, 0, 0 ) + ",  "
					+ valueColumnName + ' ' + dialect.getTypeName( Types.INTEGER )
					+ " )" + dialect.getTableTypeString()
	};
}
 
Example 4
Source File: Column.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public String getSqlType(Dialect dialect, Mapping mapping) throws HibernateException {
	if ( sqlType == null ) {
		sqlType = dialect.getTypeName( getSqlTypeCode( mapping ), getLength(), getPrecision(), getScale() );
	}
	return sqlType;
}
 
Example 5
Source File: TableGenerator.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void registerExportables(Database database) {
	final Dialect dialect = database.getJdbcEnvironment().getDialect();

	final Namespace namespace = database.locateNamespace(
			qualifiedTableName.getCatalogName(),
			qualifiedTableName.getSchemaName()
	);

	Table table = namespace.locateTable( qualifiedTableName.getObjectName() );
	if ( table == null ) {
		table = namespace.createTable( qualifiedTableName.getObjectName(), false );

		// todo : note sure the best solution here.  do we add the columns if missing?  other?
		final Column segmentColumn = new ExportableColumn(
				database,
				table,
				segmentColumnName,
				StringType.INSTANCE,
				dialect.getTypeName( Types.VARCHAR, segmentValueLength, 0, 0 )
		);
		segmentColumn.setNullable( false );
		table.addColumn( segmentColumn );

		// lol
		table.setPrimaryKey( new PrimaryKey( table ) );
		table.getPrimaryKey().addColumn( segmentColumn );

		final Column valueColumn = new ExportableColumn(
				database,
				table,
				valueColumnName,
				LongType.INSTANCE
		);
		table.addColumn( valueColumn );
	}

	// allow physical naming strategies a chance to kick in
	this.renderedTableName = database.getJdbcEnvironment().getQualifiedObjectNameFormatter().format(
			table.getQualifiedTableName(),
			dialect
	);
	table.addInitCommand( generateInsertInitCommand() );

	this.selectQuery = buildSelectQuery( dialect );
	this.updateQuery = buildUpdateQuery();
	this.insertQuery = buildInsertQuery();
}
 
Example 6
Source File: Column.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public String getSqlType(Dialect dialect, Mapping mapping) throws HibernateException {
	return sqlType==null ?
		dialect.getTypeName( getSqlTypeCode(mapping), getLength(), getPrecision(), getScale() ) :
		sqlType;
}
 
Example 7
Source File: TableStructure.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public String[] sqlCreateStrings(Dialect dialect) throws HibernateException {
	return new String[] {
			"create table " + tableName + " ( " + valueColumnName + " " + dialect.getTypeName( Types.BIGINT ) + " )",
			"insert into " + tableName + " values ( " + initialValue + " )"
	};
}
 
Example 8
Source File: TableGenerator.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public String[] sqlCreateStrings(Dialect dialect) {
	return new String[] {
		dialect.getCreateTableString() + " " + tableName + " ( " + columnName + " " + dialect.getTypeName(Types.INTEGER) + " )",
		"insert into " + tableName + " values ( 0 )"
	};
}