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

The following examples show how to use org.hibernate.dialect.Dialect#getTypeName() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
@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
@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
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 Project: lams   File: Column.java    License: 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
@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
public String getSqlType(Dialect dialect, Mapping mapping) throws HibernateException {
	return sqlType==null ?
		dialect.getTypeName( getSqlTypeCode(mapping), getLength(), getPrecision(), getScale() ) :
		sqlType;
}
 
Example 7
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
public String[] sqlCreateStrings(Dialect dialect) {
	return new String[] {
		dialect.getCreateTableString() + " " + tableName + " ( " + columnName + " " + dialect.getTypeName(Types.INTEGER) + " )",
		"insert into " + tableName + " values ( 0 )"
	};
}