public ColumnMetadata setLength(int len) { getInternal().setLength(len); return this; }
/** * Convenience method to get the column metadata for annotation values of a @Column. * @param annotationValues The values for the annotation * @return The MetaData for the column */ public static ColumnMetaData getColumnMetaDataForAnnotations(Map<String, Object> annotationValues) { ColumnMetaData colmd = new ColumnMetaData(); colmd.setName((String)annotationValues.get("name")); colmd.setTarget((String)annotationValues.get("target")); colmd.setTargetMember((String)annotationValues.get("targetField")); colmd.setJdbcType((String)annotationValues.get("jdbcType")); colmd.setSqlType((String)annotationValues.get("sqlType")); colmd.setLength((Integer)annotationValues.get("length")); colmd.setScale((Integer)annotationValues.get("scale")); colmd.setAllowsNull((String)annotationValues.get("allowsNull")); colmd.setDefaultValue((String)annotationValues.get("defaultValue")); colmd.setInsertValue((String)annotationValues.get("insertValue")); if (annotationValues.containsKey("position")) { colmd.setPosition((Integer)annotationValues.get("position")); } addExtensionsToMetaData(colmd, (Extension[])annotationValues.get("extensions")); return colmd; }
public final void checkString() throws ColumnDefinitionException { if (columnMetaData.getJdbcType() == null) { columnMetaData.setJdbcType(JdbcType.VARCHAR); } if (columnMetaData.getLength() == null) { // Use the default string length columnMetaData.setLength(getStoreManager().getIntProperty(RDBMSPropertyNames.PROPERTY_RDBMS_STRING_DEFAULT_LENGTH)); } }
/** * Initialise the mapping, setting any default precision. */ private void initialize() { // If the column has no precision specified, set its size. // If the user has already set their precision we do nothing here since they // want to control it. if (column != null && column.getColumnMetaData().getLength() == null) { // In case the default DECIMAL precision is less than the number of digits we need, set it manually if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_INTEGER)) { column.getColumnMetaData().setLength(INT_MAX_DECIMAL_DIGITS); column.checkDecimal(); } else { column.getColumnMetaData().setLength(Math.min(getTypeInfo().getPrecision(), LONG_MAX_DECIMAL_DIGITS)); column.checkDecimal(); } } initTypeInfo(); }
public void addColumnWithLength(final String typeName, final int columnLength) { final MappingManager mgr = getStoreManager().getMappingManager(); Column column = null; if (table != null) { column = mgr.createColumn(this, typeName, getNumberOfDatastoreMappings()); /* TODO metaData.setJdbcType("NCHAR") */ column.setColumnMetaData(column.getColumnMetaData().setLength(columnLength)); } mgr.createDatastoreMapping(this, column, typeName); }
colmd.setJdbcType(jdbcType); colmd.setSqlType(sqlType); colmd.setLength(length); colmd.setScale(scale); colmd.setAllowsNull(allowsNull);
colmd.setLength(storeMgr.getIntProperty(RDBMSPropertyNames.PROPERTY_RDBMS_STRING_DEFAULT_LENGTH));
colmd.setJdbcType(jdbcType); colmd.setSqlType(sqlType); colmd.setLength(length); colmd.setScale(scale); colmd.setAllowsNull(allowsNull);
Column class_column= addColumn(String.class.getName(), idFactory.newColumnIdentifier("CLASS_NAME"), classMapping, null); mapMgr.createDatastoreMapping(classMapping, class_column, String.class.getName()); class_column.getColumnMetaData().setLength(128); class_column.getColumnMetaData().setJdbcType(JdbcType.VARCHAR); class_column.setPrimaryKey(); Column table_column= addColumn(String.class.getName(), idFactory.newColumnIdentifier("TABLE_NAME"), tableMapping, null); mapMgr.createDatastoreMapping(tableMapping, table_column, String.class.getName()); table_column.getColumnMetaData().setLength(128); table_column.getColumnMetaData().setJdbcType(JdbcType.VARCHAR); Column type_column= addColumn(String.class.getName(), idFactory.newColumnIdentifier("TYPE"), typeMapping, null); mapMgr.createDatastoreMapping(typeMapping, type_column, String.class.getName()); type_column.getColumnMetaData().setLength(4); type_column.getColumnMetaData().setJdbcType(JdbcType.VARCHAR); Column owner_column = addColumn(String.class.getName(), idFactory.newColumnIdentifier("OWNER"), ownerMapping, null); mapMgr.createDatastoreMapping(ownerMapping, owner_column, String.class.getName()); owner_column.getColumnMetaData().setLength(2); owner_column.getColumnMetaData().setJdbcType(JdbcType.VARCHAR); Column version_column = addColumn(String.class.getName(), idFactory.newColumnIdentifier("VERSION"), versionMapping, null); mapMgr.createDatastoreMapping(versionMapping, version_column, String.class.getName()); version_column.getColumnMetaData().setLength(20); version_column.getColumnMetaData().setJdbcType(JdbcType.VARCHAR); Column interfaceName_column = addColumn(String.class.getName(), idFactory.newColumnIdentifier("INTERFACE_NAME"), interfaceNameMapping, null); mapMgr.createDatastoreMapping(interfaceNameMapping, interfaceName_column, String.class.getName()); interfaceName_column.getColumnMetaData().setLength(255);
discolmd.setLength(discriminatorColumnLength);
colmd.setJdbcType(col.jdbcType()); colmd.setSqlType(col.sqlType()); colmd.setLength(length); colmd.setScale(scale); colmd.setAllowsNull(col.allowsNull());
Column colSequenceName = addColumn(String.class.getName(), idFactory.newColumnIdentifier(sequenceNameColumnName), sequenceNameMapping, null); colSequenceName.setPrimaryKey(); colSequenceName.getColumnMetaData().setLength(Integer.valueOf("255")); colSequenceName.getColumnMetaData().setJdbcType(JdbcType.VARCHAR); getStoreManager().getMappingManager().createDatastoreMapping(sequenceNameMapping, colSequenceName, String.class.getName());
col.getColumnMetaData().setLength(this.columnMetaData.getLength());
columnMetaData.setLength(colmd.getLength());
column.getColumnMetaData().setLength(m.getDefaultLength(0));
colmd.setLength(cmd.getValueForExtension(MetaData.EXTENSION_CLASS_MULTITENANCY_COLUMN_LENGTH));