@Override public String getTableName(ClassMapping cls, Schema schema) { if (cls.getTypeAlias() != null) return cls.getTypeAlias(); return ClassUtil.getClassName(cls.getDescribedType()).replace('$', '_'); }
@Override public String getTableName(ClassMapping cls, Schema schema) { if (cls.getTypeAlias() != null) return cls.getTypeAlias(); return ClassUtil.getClassName(cls.getDescribedType()).replace('$', '_'); }
@Override public String getTableName(ClassMapping cls, Schema schema) { if (cls.getTypeAlias() != null) return cls.getTypeAlias(); return Strings.getClassName(cls.getDescribedType()).replace('$', '_'); }
@Override public String getTableName(ClassMapping cls, Schema schema) { if (cls.getTypeAlias() != null) return cls.getTypeAlias(); return Strings.getClassName(cls.getDescribedType()).replace('$', '_'); }
/** * Return the table for the given class. */ public Table getTable(final ClassMapping cls, boolean adapt) { Table t = createTable(cls, new TableDefaults() { public String get(Schema schema) { // delay this so that we don't do schema reflection for unique // table name unless necessary return cls.getMappingRepository().getMappingDefaults(). getTableName(cls, schema); } }, _schemaName, _tableName, adapt); t.setComment(cls.getTypeAlias() == null ? cls.getDescribedType().getName() : cls.getTypeAlias()); return t; }
/** * Return the named table for the given class. */ public Table getTable(final ClassMapping cls, DBIdentifier tableName, boolean adapt) { Table t = createTable(cls, new TableDefaults() { public String get(Schema schema) { // delay this so that we don't do schema reflection for unique // table name unless necessary return cls.getMappingRepository().getMappingDefaults(). getTableName(cls, schema); } public DBIdentifier getIdentifier(Schema schema) { return cls.getMappingRepository().getMappingDefaults(). getTableIdentifier(cls, schema); } }, _schemaName, tableName, adapt); t.setComment(cls.getTypeAlias() == null ? cls.getDescribedType().getName() : cls.getTypeAlias()); return t; }
/** * Return the named table for the given class. */ public Table getTable(final ClassMapping cls, DBIdentifier tableName, boolean adapt) { Table t = createTable(cls, new TableDefaults() { public String get(Schema schema) { // delay this so that we don't do schema reflection for unique // table name unless necessary return cls.getMappingRepository().getMappingDefaults(). getTableName(cls, schema); } public DBIdentifier getIdentifier(Schema schema) { return cls.getMappingRepository().getMappingDefaults(). getTableIdentifier(cls, schema); } }, _schemaName, tableName, adapt); t.setComment(cls.getTypeAlias() == null ? cls.getDescribedType().getName() : cls.getTypeAlias()); return t; }
private String getKey(ClassMapping mapping, boolean db) { if (_ignore) { while (mapping.getMappedPCSuperclassMapping() != null) mapping = mapping.getMappedPCSuperclassMapping(); } else { while (mapping.getPCSuperclass() != null) mapping = mapping.getPCSuperclassMapping(); } if (_aliases) return mapping.getTypeAlias(); return mapping.getDescribedType().getName(); }
private String getKey(ClassMapping mapping, boolean db) { if (_ignore) { while (mapping.getMappedPCSuperclassMapping() != null) mapping = mapping.getMappedPCSuperclassMapping(); } else { while (mapping.getPCSuperclass() != null) mapping = mapping.getPCSuperclassMapping(); } if (_aliases) return mapping.getTypeAlias(); return mapping.getDescribedType().getName(); }
private String getKey(ClassMapping mapping, boolean db) { if (_ignore) { while (mapping.getMappedPCSuperclassMapping() != null) mapping = mapping.getMappedPCSuperclassMapping(); } else { while (mapping.getPCSuperclass() != null) mapping = mapping.getPCSuperclassMapping(); } if (_aliases) return mapping.getTypeAlias(); return mapping.getDescribedType().getName(); }
private String getKey(ClassMapping mapping, boolean db) { if (_ignore) { while (mapping.getMappedPCSuperclassMapping() != null) mapping = mapping.getMappedPCSuperclassMapping(); } else { while (mapping.getPCSuperclass() != null) mapping = mapping.getPCSuperclassMapping(); } if (_aliases) return mapping.getTypeAlias(); return mapping.getDescribedType().getName(); }
private String getKey(ClassMapping mapping, boolean db) { if (_ignore) { while (mapping.getMappedPCSuperclassMapping() != null) mapping = mapping.getMappedPCSuperclassMapping(); } else { while (mapping.getPCSuperclass() != null) mapping = mapping.getPCSuperclassMapping(); } if (_aliases) return mapping.getTypeAlias(); return mapping.getDescribedType().getName(); }
@Override public void populateJoinColumn(FieldMapping fm, Table local, Table foreign, Column col, Object target, int pos, int cols) { // only use spec defaults with column targets if (!(target instanceof Column)) return; // if this is a bidi relation, prefix with inverse field name, else // prefix with owning entity name FieldMapping[] inverses = fm.getInverseMappings(); String name; if (inverses.length > 0) name = inverses[0].getName(); else name = fm.getDefiningMapping().getTypeAlias(); String targetName = ((Column) target).getName(); String tempName = null; if ((name.length() + targetName.length()) >= dict.maxColumnNameLength) tempName = name.substring(0, dict.maxColumnNameLength - targetName.length() - 1); // suffix with '_' + target column if (tempName == null) tempName = name; name = tempName + "_" + targetName; name = dict.getValidColumnName(name, foreign); col.setName(name); }
/** * Return the named table for the given class. */ public Table getTable(final ClassMapping cls, DBIdentifier tableName, boolean adapt) { // If the schemaName is NULL type then check for a system default schema name // and if available use it. if (_schemaName != null && _schemaName.getType() == DBIdentifierType.NULL){ String name = cls.getMappingRepository().getMetaDataFactory().getDefaults().getDefaultSchema(); _schemaName = (name != null ? DBIdentifier.newSchema(name) : _schemaName); } Table t = createTable(cls, new TableDefaults() { public String get(Schema schema) { // delay this so that we don't do schema reflection for unique // table name unless necessary return cls.getMappingRepository().getMappingDefaults(). getTableName(cls, schema); } public DBIdentifier getIdentifier(Schema schema) { return cls.getMappingRepository().getMappingDefaults(). getTableIdentifier(cls, schema); } }, _schemaName, tableName, adapt); t.setComment(cls.getTypeAlias() == null ? cls.getDescribedType().getName() : cls.getTypeAlias()); return t; }
sName = DBIdentifier.newTable(clm.getTypeAlias()); else sName = table.getIdentifier();
sName = DBIdentifier.newTable(clm.getTypeAlias()); else sName = table.getIdentifier();
sName = DBIdentifier.newTable(clm.getTypeAlias()); else sName = table.getIdentifier();
@Override public void populateJoinColumn(FieldMapping fm, Table local, Table foreign, Column col, Object target, int pos, int cols) { // only use spec defaults with column targets if (!(target instanceof Column)) return; // if this is a bidi relation, prefix with inverse field name, else // prefix with owning entity name FieldMapping[] inverses = fm.getInverseMappings(); DBIdentifier sName = DBIdentifier.NULL; if (inverses.length > 0) sName = DBIdentifier.newColumn(inverses[0].getName()); else sName = DBIdentifier.newColumn(fm.getDefiningMapping().getTypeAlias()); DBIdentifier targetName = ((Column) target).getIdentifier(); DBIdentifier tempName = DBIdentifier.NULL; if ((sName.length() + targetName.length()) >= dict.maxColumnNameLength) tempName = DBIdentifier.truncate(sName, dict.maxColumnNameLength - targetName.length() - 1); // suffix with '_' + target column if (DBIdentifier.isNull(tempName)) tempName = sName; sName = DBIdentifier.combine(tempName, targetName.getName()); sName = dict.getValidColumnName(sName, foreign); col.setIdentifier(sName); }
@Override public void populateJoinColumn(FieldMapping fm, Table local, Table foreign, Column col, Object target, int pos, int cols) { // only use spec defaults with column targets if (!(target instanceof Column)) return; // if this is a bidi relation, prefix with inverse field name, else // prefix with owning entity name FieldMapping[] inverses = fm.getInverseMappings(); DBIdentifier sName = DBIdentifier.NULL; if (inverses.length > 0) sName = DBIdentifier.newColumn(inverses[0].getName()); else sName = DBIdentifier.newColumn(fm.getDefiningMapping().getTypeAlias()); DBIdentifier targetName = ((Column) target).getIdentifier(); DBIdentifier tempName = DBIdentifier.NULL; if ((sName.length() + targetName.length()) >= dict.maxColumnNameLength) tempName = DBIdentifier.truncate(sName, dict.maxColumnNameLength - targetName.length() - 1); // suffix with '_' + target column if (DBIdentifier.isNull(tempName)) tempName = sName; sName = DBIdentifier.combine(tempName, targetName.getName()); sName = dict.getValidColumnName(sName, foreign); col.setIdentifier(sName); }
@Override public void populateJoinColumn(FieldMapping fm, Table local, Table foreign, Column col, Object target, int pos, int cols) { // only use spec defaults with column targets if (!(target instanceof Column)) return; // if this is a bidi relation, prefix with inverse field name, else // prefix with owning entity name FieldMapping[] inverses = fm.getInverseMappings(); DBIdentifier sName = DBIdentifier.NULL; if (inverses.length > 0) sName = DBIdentifier.newColumn(inverses[0].getName()); else sName = DBIdentifier.newColumn(fm.getDefiningMapping().getTypeAlias()); DBIdentifier targetName = ((Column) target).getIdentifier(); DBIdentifier tempName = DBIdentifier.NULL; if ((sName.length() + targetName.length()) >= dict.maxColumnNameLength) tempName = DBIdentifier.truncate(sName, dict.maxColumnNameLength - targetName.length() - 1); // suffix with '_' + target column if (DBIdentifier.isNull(tempName)) tempName = sName; sName = DBIdentifier.combine(tempName, targetName.getName()); sName = dict.getValidColumnName(sName, foreign); col.setIdentifier(sName); }