/** * Return the unquoted version of name (stripping the start and end '`' characters if present). * * @param name The name to be unquoted. * * @return The unquoted version. */ public static String unquote(String name) { return isQuoted( name ) ? name.substring( 1, name.length() - 1 ) : name; }
/** * Return the unquoted version of name stripping the start and end quote characters. * * @param name The name to be unquoted. * @param dialect The dialect (to determine the "real" quoting chars). * * @return The unquoted version. */ public static String unquote(String name, Dialect dialect) { return isQuoted( name, dialect ) ? name.substring( 1, name.length() - 1 ) : name; }
/** * Return a representation of the given name ensuring quoting (wrapped with '`' characters). If already wrapped * return name. * * @param name The name to quote. * * @return The quoted version. */ public static String quote(String name) { if ( isEmpty( name ) || isQuoted( name ) ) { return name; } // Convert the JPA2 specific quoting character (double quote) to Hibernate's (back tick) else if ( name.startsWith( "\"" ) && name.endsWith( "\"" ) ) { name = name.substring( 1, name.length() - 1 ); } return "`" + name + '`'; }
if ( StringHelper.isQuoted( identifier, dialect ) ) { return extractIdentifier( rs, StringHelper.unquote( identifier, dialect ), type, clazz );
@Override protected void addColumnBinding(SimpleValue value) { if ( StringHelper.isEmpty( mappedBy ) ) { // was the column explicitly quoted in the mapping/annotation // TODO: in metamodel, we need to better split global quoting and explicit quoting w/ respect to logical names boolean isLogicalColumnQuoted = StringHelper.isQuoted( getLogicalColumnName() ); final ObjectNameNormalizer nameNormalizer = getBuildingContext().getObjectNameNormalizer(); final String logicalColumnName = nameNormalizer.normalizeIdentifierQuotingAsString( getLogicalColumnName() ); final String referencedColumn = nameNormalizer.normalizeIdentifierQuotingAsString( getReferencedColumn() ); final String unquotedLogColName = StringHelper.unquote( logicalColumnName ); final String unquotedRefColumn = StringHelper.unquote( referencedColumn ); String logicalCollectionColumnName = StringHelper.isNotEmpty( unquotedLogColName ) ? unquotedLogColName : getPropertyName() + '_' + unquotedRefColumn; logicalCollectionColumnName = getBuildingContext().getMetadataCollector() .getDatabase() .getJdbcEnvironment() .getIdentifierHelper() .toIdentifier( logicalCollectionColumnName, isLogicalColumnQuoted ) .render(); getBuildingContext().getMetadataCollector().addColumnNameBinding( value.getTable(), logicalCollectionColumnName, getMappingColumn() ); } }
boolean ownerSide = getPropertyName() != null; boolean isRefColumnQuoted = StringHelper.isQuoted( logicalReferencedColumn ); final String unquotedLogicalReferenceColumn = isRefColumnQuoted ? StringHelper.unquote( logicalReferencedColumn ) if ( isRefColumnQuoted || StringHelper.isQuoted( mappedByTableName ) ) { columnIdentifier = Identifier.quote( columnIdentifier ); if ( isRefColumnQuoted || StringHelper.isQuoted( logicalTableName ) ) { columnIdentifier = Identifier.quote( columnIdentifier );
/** * Return the unquoted version of name (stripping the start and end '`' characters if present). * * @param name The name to be unquoted. * * @return The unquoted version. */ public static String unquote(String name) { return isQuoted( name ) ? name.substring( 1, name.length() - 1 ) : name; }
/** * Return the unquoted version of name stripping the start and end quote characters. * * @param name The name to be unquoted. * @param dialect The dialect (to determine the "real" quoting chars). * * @return The unquoted version. */ public static String unquote(String name, Dialect dialect) { return isQuoted( name, dialect ) ? name.substring( 1, name.length() - 1 ) : name; }
/** * Return the unquoted version of name (stripping the start and end '`' characters if present). * * @param name The name to be unquoted. * @return The unquoted version. */ public static String unquote(String name) { if ( isQuoted( name ) ) { return name.substring( 1, name.length() - 1 ); } else { return name; } }
/** * Return the unquoted version of name (stripping the start and end '`' characters if present). * * @param name The name to be unquoted. * @return The unquoted version. */ public static String unquote(String name) { if ( isQuoted( name ) ) { return name.substring( 1, name.length() - 1 ); } else { return name; } }
/** * Return the unquoted version of name stripping the start and end quote characters. * * @param name The name to be unquoted. * @param dialect The dialect (to determine the "real" quoting chars). * * @return The unquoted version. */ public static String unquote(String name, Dialect dialect) { if ( isQuoted( name, dialect ) ) { return name.substring( 1, name.length() - 1 ); } else { return name; } }
/** * Return the unquoted version of name stripping the start and end quote characters. * * @param name The name to be unquoted. * @param dialect The dialect (to determine the "real" quoting chars). * * @return The unquoted version. */ public static String unquote(String name, Dialect dialect) { if ( isQuoted( name, dialect ) ) { return name.substring( 1, name.length() - 1 ); } else { return name; } }
/** * Return a representation of the given name ensuring quoting (wrapped with '`' characters). If already wrapped * return name. * * @param name The name to quote. * @return The quoted version. */ public static String quote(String name) { if ( isEmpty( name ) || isQuoted( name ) ) { return name; } // Convert the JPA2 specific quoting character (double quote) to Hibernate's (back tick) else if ( name.startsWith( "\"" ) && name.endsWith( "\"" ) ) { name = name.substring( 1, name.length() - 1 ); } return new StringBuilder( name.length() + 2 ).append('`').append( name ).append( '`' ).toString(); }
/** * Return a representation of the given name ensuring quoting (wrapped with '`' characters). If already wrapped * return name. * * @param name The name to quote. * @return The quoted version. */ public static String quote(String name) { if ( isEmpty( name ) || isQuoted( name ) ) { return name; } // Convert the JPA2 specific quoting character (double quote) to Hibernate's (back tick) else if ( name.startsWith( "\"" ) && name.endsWith( "\"" ) ) { name = name.substring( 1, name.length() - 1 ); } return new StringBuilder( name.length() + 2 ).append('`').append( name ).append( '`' ).toString(); }
/** * Return a representation of the given name ensuring quoting (wrapped with '`' characters). If already wrapped * return name. * * @param name The name to quote. * * @return The quoted version. */ public static String quote(String name) { if ( isEmpty( name ) || isQuoted( name ) ) { return name; } // Convert the JPA2 specific quoting character (double quote) to Hibernate's (back tick) else if ( name.startsWith( "\"" ) && name.endsWith( "\"" ) ) { name = name.substring( 1, name.length() - 1 ); } return "`" + name + '`'; }
private ObjectNameSource buildNameContext(String unquotedOwnerTable, String unquotedAssocTable) { String logicalName = mappings.getNamingStrategy().logicalCollectionTableName( name, unquotedOwnerTable, unquotedAssocTable, propertyName ); if ( StringHelper.isQuoted( ownerEntityTable ) || StringHelper.isQuoted( associatedEntityTable ) ) { logicalName = StringHelper.quote( logicalName ); } return new AssociationTableNameSource( name, logicalName ); }
private ObjectNameSource buildNameContext(String unquotedOwnerTable, String unquotedAssocTable) { String logicalName = mappings.getNamingStrategy().logicalCollectionTableName( name, unquotedOwnerTable, unquotedAssocTable, propertyName ); if ( StringHelper.isQuoted( ownerEntityTable ) || StringHelper.isQuoted( associatedEntityTable ) ) { logicalName = StringHelper.quote( logicalName ); } return new AssociationTableNameSource( name, logicalName ); }
@Override protected void addColumnBinding(SimpleValue value) { if ( StringHelper.isEmpty( mappedBy ) ) { String unquotedLogColName = StringHelper.unquote( getLogicalColumnName() ); String unquotedRefColumn = StringHelper.unquote( getReferencedColumn() ); String logicalColumnName = getMappings().getNamingStrategy() .logicalCollectionColumnName( unquotedLogColName, getPropertyName(), unquotedRefColumn ); if ( StringHelper.isQuoted( getLogicalColumnName() ) || StringHelper.isQuoted( getLogicalColumnName() ) ) { logicalColumnName = StringHelper.quote( logicalColumnName ); } getMappings().addColumnBinding( logicalColumnName, getMappingColumn(), value.getTable() ); } }
@Override protected void addColumnBinding(SimpleValue value) { if ( StringHelper.isEmpty( mappedBy ) ) { String unquotedLogColName = StringHelper.unquote( getLogicalColumnName() ); String unquotedRefColumn = StringHelper.unquote( getReferencedColumn() ); String logicalColumnName = getMappings().getNamingStrategy() .logicalCollectionColumnName( unquotedLogColName, getPropertyName(), unquotedRefColumn ); if ( StringHelper.isQuoted( getLogicalColumnName() ) || StringHelper.isQuoted( getLogicalColumnName() ) ) { logicalColumnName = StringHelper.quote( logicalColumnName ); } getMappings().addColumnBinding( logicalColumnName, getMappingColumn(), value.getTable() ); } }