Java Code Examples for org.hibernate.internal.util.StringHelper#unquote()

The following examples show how to use org.hibernate.internal.util.StringHelper#unquote() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultEntityAliases.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private String[] determineKeyAlias(Loadable persister, String suffix) {
	final String[] aliases;
	final String[] keyColumnsCandidates = getUserProvidedAliases( persister.getIdentifierPropertyName(), null );
	if ( keyColumnsCandidates == null ) {
		aliases = getUserProvidedAliases(
				"id",
				getIdentifierAliases(persister, suffix)
		);
	}
	else {
		aliases = keyColumnsCandidates;
	}
	final String[] rtn = StringHelper.unquote( aliases, persister.getFactory().getDialect() );
	intern( rtn );
	return rtn;
}
 
Example 2
Source File: DefaultEntityAliases.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String[][] getSuffixedPropertyAliases(Loadable persister) {
	final int size = persister.getPropertyNames().length;
	final String[][] suffixedPropertyAliases;
	if (size > 0) {
		suffixedPropertyAliases = new String[size][];
		for ( int j = 0; j < size; j++ ) {
			suffixedPropertyAliases[j] = getUserProvidedAliases(
					persister.getPropertyNames()[j],
					getPropertyAliases( persister, j )
			);
			suffixedPropertyAliases[j] = StringHelper.unquote( suffixedPropertyAliases[j], persister.getFactory().getDialect() );
			intern( suffixedPropertyAliases[j] );
		}
	}
	else {
		suffixedPropertyAliases = EMPTY_ARRAY_OF_ARRAY_OF_STRINGS;
	}
	return suffixedPropertyAliases;
}
 
Example 3
Source File: Ejb3JoinColumn.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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()
		);
	}
}
 
Example 4
Source File: DefaultEntityAliases.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private String determineDiscriminatorAlias(Loadable persister, String suffix) {
	String alias = getUserProvidedAlias( "class", getDiscriminatorAlias( persister, suffix ) );
	return StringHelper.unquote( alias, persister.getFactory().getDialect() );
}