public String determineImplicitName(NamingStrategy strategy) { return strategy.classToTableName( entityName ); }
private String getClassTableName(String tableName) { if ( StringHelper.isEmpty( tableName ) ) { return mappings.getNamingStrategy().classToTableName( name ); } else { return mappings.getNamingStrategy().tableName( tableName ); } }
public String determineImplicitName(NamingStrategy strategy) { return strategy.classToTableName( entityName ); }
public String determineImplicitName(NamingStrategy strategy) { return strategy.classToTableName( entityName ); }
@Override public Identifier determinePrimaryTableName(ImplicitEntityNameSource source) { String result = hibernate4Strategy .classToTableName(source.getEntityNaming().getEntityName()); return toIdentifier(result, source.getBuildingContext()); }
tableName = getNamingStrategy(sessionFactoryBeanName).classToTableName(shortName);
private static String getClassTableName(PersistentClass model, Element node, Mappings mappings) { Attribute tableNameNode = node.attribute( "table" ); if ( tableNameNode == null ) { return mappings.getNamingStrategy().classToTableName( model.getEntityName() ); } else { return mappings.getNamingStrategy().tableName( tableNameNode.getValue() ); } }
tableName = getNamingStrategy(sessionFactoryBeanName).classToTableName(shortName);
private static void bindCompositeIdentifierToManyToOne(GrailsDomainClassProperty property, SimpleValue value, CompositeIdentity compositeId, GrailsDomainClass refDomainClass, String path, String sessionFactoryBeanName) { NamingStrategy namingStrategy = getNamingStrategy(sessionFactoryBeanName); String[] propertyNames = compositeId.getPropertyNames(); PropertyConfig config = getPropertyConfig(property); if (config == null) config = new PropertyConfig(); if (config.getColumns().size() != propertyNames.length) { for (String propertyName : propertyNames) { final ColumnConfig cc = new ColumnConfig(); cc.setName(addUnderscore(namingStrategy.classToTableName(refDomainClass.getShortName()), getDefaultColumnName(refDomainClass.getPropertyByName(propertyName), sessionFactoryBeanName))); config.getColumns().add(cc); } } bindSimpleValue(property, value, path, config, sessionFactoryBeanName); }
private static String getClassTableName( PersistentClass model, Element node, String schema, String catalog, Table denormalizedSuperTable, Mappings mappings ) { Attribute tableNameNode = node.attribute( "table" ); String logicalTableName; String physicalTableName; if ( tableNameNode == null ) { logicalTableName = StringHelper.unqualify( model.getEntityName() ); physicalTableName = mappings.getNamingStrategy().classToTableName( model.getEntityName() ); } else { logicalTableName = tableNameNode.getValue(); physicalTableName = mappings.getNamingStrategy().tableName( logicalTableName ); } mappings.addTableBinding( schema, catalog, logicalTableName, physicalTableName, denormalizedSuperTable ); return physicalTableName; }
private static String getClassTableName( PersistentClass model, Element node, String schema, String catalog, Table denormalizedSuperTable, Mappings mappings) { Attribute tableNameNode = node.attribute( "table" ); String logicalTableName; String physicalTableName; if ( tableNameNode == null ) { logicalTableName = StringHelper.unqualify( model.getEntityName() ); physicalTableName = mappings.getNamingStrategy().classToTableName( model.getEntityName() ); } else { logicalTableName = tableNameNode.getValue(); physicalTableName = mappings.getNamingStrategy().tableName( logicalTableName ); } mappings.addTableBinding( schema, catalog, logicalTableName, physicalTableName, denormalizedSuperTable ); return physicalTableName; }
private static String getClassTableName( PersistentClass model, Element node, String schema, String catalog, Table denormalizedSuperTable, Mappings mappings) { Attribute tableNameNode = node.attribute( "table" ); String logicalTableName; String physicalTableName; if ( tableNameNode == null ) { logicalTableName = StringHelper.unqualify( model.getEntityName() ); physicalTableName = mappings.getNamingStrategy().classToTableName( model.getEntityName() ); } else { logicalTableName = tableNameNode.getValue(); physicalTableName = mappings.getNamingStrategy().tableName( logicalTableName ); } mappings.addTableBinding( schema, catalog, logicalTableName, physicalTableName, denormalizedSuperTable ); return physicalTableName; }
private Table createTable(EntityBinding entityBinding, TableSource tableSource) { String tableName = tableSource.getExplicitTableName(); if ( StringHelper.isEmpty( tableName ) ) { tableName = currentBindingContext.getNamingStrategy() .classToTableName( entityBinding.getEntity().getClassName() ); } else { tableName = currentBindingContext.getNamingStrategy().tableName( tableName ); } tableName = quoteIdentifier( tableName ); final Schema.Name databaseSchemaName = Helper.determineDatabaseSchemaName( tableSource.getExplicitSchemaName(), tableSource.getExplicitCatalogName(), currentBindingContext ); return currentBindingContext.getMetadataImplementor() .getDatabase() .locateSchema( databaseSchemaName ) .locateOrCreateTable( Identifier.toIdentifier( tableName ) ); }
private Table createTable(EntityBinding entityBinding, TableSource tableSource) { String tableName = tableSource.getExplicitTableName(); if ( StringHelper.isEmpty( tableName ) ) { tableName = currentBindingContext.getNamingStrategy() .classToTableName( entityBinding.getEntity().getClassName() ); } else { tableName = currentBindingContext.getNamingStrategy().tableName( tableName ); } tableName = quoteIdentifier( tableName ); final Schema.Name databaseSchemaName = Helper.determineDatabaseSchemaName( tableSource.getExplicitSchemaName(), tableSource.getExplicitCatalogName(), currentBindingContext ); return currentBindingContext.getMetadataImplementor() .getDatabase() .locateSchema( databaseSchemaName ) .locateOrCreateTable( Identifier.toIdentifier( tableName ) ); }
protected String getDefaultColumnName(PersistentProperty property, String sessionFactoryBeanName) { NamingStrategy namingStrategy = getNamingStrategy(sessionFactoryBeanName); String columnName = namingStrategy.propertyToColumnName(property.getName()); if (property instanceof Association) { Association association = (Association) property; boolean isBasic = property instanceof Basic; if(isBasic && ((PropertyConfig)property.getMapping().getMappedForm()).getType() != null ) { return columnName; } if (isBasic) { return getForeignKeyForPropertyDomainClass(property, sessionFactoryBeanName); } if (property instanceof ManyToMany) { return getForeignKeyForPropertyDomainClass(property, sessionFactoryBeanName); } if (!association.isBidirectional() && association instanceof org.grails.datastore.mapping.model.types.OneToMany) { String prefix = namingStrategy.classToTableName(property.getOwner().getName()); return addUnderscore(prefix, columnName) + FOREIGN_KEY_SUFFIX; } if (property.isInherited() && isBidirectionalManyToOne(property)) { return namingStrategy.propertyToColumnName(property.getOwner().getName()) + '_'+ columnName + FOREIGN_KEY_SUFFIX; } return columnName + FOREIGN_KEY_SUFFIX; } return columnName; }
private static String getDefaultColumnName(GrailsDomainClassProperty property, String sessionFactoryBeanName) { NamingStrategy namingStrategy = getNamingStrategy(sessionFactoryBeanName); String columnName = namingStrategy.propertyToColumnName(property.getName()); if (property.isAssociation() && property.getReferencedDomainClass() != null) { if (property.isManyToMany()) { return getForeignKeyForPropertyDomainClass(property, sessionFactoryBeanName); } if (!property.isBidirectional() && property.isOneToMany()) { String prefix = namingStrategy.classToTableName(property.getDomainClass().getName()); return addUnderscore(prefix, columnName) + FOREIGN_KEY_SUFFIX; } if (property.isInherited() && isBidirectionalManyToOne(property)) { return namingStrategy.propertyToColumnName(property.getDomainClass().getName()) + '_'+ columnName + FOREIGN_KEY_SUFFIX; } return columnName + FOREIGN_KEY_SUFFIX; } if (property.isBasicCollectionType()) { return getForeignKeyForPropertyDomainClass(property, sessionFactoryBeanName); } return columnName; }