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

The following are Jave code examples for showing how to use getTypeName() of the org.hibernate.dialect.Dialect class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: lams   File: Table.java   View Source Code Vote up 6 votes
private static String getTypeString(Column col, Dialect dialect) {
	String typeString = null;
	if ( col.getSqlType() != null ) {
		typeString = col.getSqlType();
	}
	else {
		Size size = col.getSize() == null ?
				new Size( ) :
				col.getSize();

		typeString = dialect.getTypeName(
					col.getDatatype().getTypeCode(),
					size.getLength(),
					size.getPrecision(),
					size.getScale()
		);
	}
	return typeString;
}
 
Example 2
Project: lams   File: TableGenerator.java   View Source Code Vote up 5 votes
@Override
public String[] sqlCreateStrings(Dialect dialect) throws HibernateException {
	return new String[] {
			dialect.getCreateTableString() + ' ' + tableName + " ( "
					+ segmentColumnName + ' ' + dialect.getTypeName( Types.VARCHAR, segmentValueLength, 0, 0 ) + " not null "
					+ ", " + valueColumnName + ' ' + dialect.getTypeName( Types.BIGINT )
					+ ", primary key ( " + segmentColumnName + " ) )" + dialect.getTableTypeString()
	};
}
 
Example 3
Project: lams   File: TableStructure.java   View Source Code Vote up 5 votes
@Override
public String[] sqlCreateStrings(Dialect dialect) throws HibernateException {
	return new String[] {
			dialect.getCreateTableString() + " " + tableName + " ( " + valueColumnName + " " + dialect.getTypeName( Types.BIGINT ) + " )",
			"insert into " + tableName + " values ( " + initialValue + " )"
	};
}
 
Example 4
Project: lams   File: TableGenerator.java   View Source Code Vote up 5 votes
public String[] sqlCreateStrings(Dialect dialect) throws HibernateException {
	return new String[] {
		dialect.getCreateTableString() + " " + tableName + " ( "
				+ columnName + " " + dialect.getTypeName(Types.INTEGER) + " )" + dialect.getTableTypeString(),
		"insert into " + tableName + " values ( 0 )"
	};
}
 
Example 5
Project: lams   File: Column.java   View Source Code Vote up 4 votes
public String getSqlType(Dialect dialect, Mapping mapping) throws HibernateException {
    if ( sqlType == null ) {
        sqlType = dialect.getTypeName( getSqlTypeCode( mapping ), getLength(), getPrecision(), getScale() );
    }
    return sqlType;
}