HHH-9722
Changed all toLowerCase() and toUpperCase() to toLowerCase(Locale.ROOT), toUpperCase(Locale.ROOT). Conflicts: hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/XmlElementMetadata.java hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/AttributeTypeDescriptor.java hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java hibernate-core/src/main/java/org/hibernate/dialect/HSQLDialect.java hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java hibernate-core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java hibernate-core/src/main/java/org/hibernate/dialect/pagination/FirstLimitHandler.java hibernate-core/src/main/java/org/hibernate/dialect/pagination/TopLimitHandler.java hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/ExtractedDatabaseMetaDataImpl.java hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentImpl.java hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/NormalizingIdentifierHelperImpl.java hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaValidatorImpl.java hibernate-core/src/test/java/org/hibernate/dialect/SQLServer2005DialectTestCase.java hibernate-core/src/test/java/org/hibernate/test/annotations/namingstrategy/NamingStrategyTest.java hibernate-envers/src/main/java/org/hibernate/envers/query/criteria/internal/IlikeAuditExpression.java
This commit is contained in:
parent
9bd04e7783
commit
8db83f5221
|
@ -23,6 +23,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate;
|
package org.hibernate;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls how the session interacts with the second-level cache and query cache.
|
* Controls how the session interacts with the second-level cache and query cache.
|
||||||
*
|
*
|
||||||
|
@ -100,7 +102,7 @@ public enum CacheMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return CacheMode.valueOf( setting.toUpperCase() );
|
return CacheMode.valueOf( setting.toUpperCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
catch ( IllegalArgumentException e ) {
|
catch ( IllegalArgumentException e ) {
|
||||||
throw new MappingException( "Unknown Cache Mode: " + setting );
|
throw new MappingException( "Unknown Cache Mode: " + setting );
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate;
|
package org.hibernate;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the various policies by which Hibernate might release its underlying
|
* Defines the various policies by which Hibernate might release its underlying
|
||||||
* JDBC connection.
|
* JDBC connection.
|
||||||
|
@ -61,6 +63,6 @@ public enum ConnectionReleaseMode{
|
||||||
* @return The matched enum value.
|
* @return The matched enum value.
|
||||||
*/
|
*/
|
||||||
public static ConnectionReleaseMode parse(final String name) {
|
public static ConnectionReleaseMode parse(final String name) {
|
||||||
return ConnectionReleaseMode.valueOf( name.toUpperCase() );
|
return ConnectionReleaseMode.valueOf( name.toUpperCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate;
|
package org.hibernate;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a flushing strategy. The flush process synchronizes
|
* Represents a flushing strategy. The flush process synchronizes
|
||||||
* database state with session state by detecting state changes
|
* database state with session state by detecting state changes
|
||||||
|
@ -119,7 +121,7 @@ public enum FlushMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return FlushMode.valueOf( externalName.toUpperCase() );
|
return FlushMode.valueOf( externalName.toUpperCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
catch ( IllegalArgumentException e ) {
|
catch ( IllegalArgumentException e ) {
|
||||||
throw new MappingException( "unknown FlushMode : " + externalName );
|
throw new MappingException( "unknown FlushMode : " + externalName );
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate;
|
package org.hibernate;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
|
@ -88,7 +89,7 @@ public enum MultiTenancyStrategy {
|
||||||
|
|
||||||
final String strategyName = strategy.toString();
|
final String strategyName = strategy.toString();
|
||||||
try {
|
try {
|
||||||
return MultiTenancyStrategy.valueOf( strategyName.toUpperCase() );
|
return MultiTenancyStrategy.valueOf( strategyName.toUpperCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
catch ( RuntimeException e ) {
|
catch ( RuntimeException e ) {
|
||||||
LOG.warn( "Unknown multi tenancy strategy [ " +strategyName +" ], using MultiTenancyStrategy.NONE." );
|
LOG.warn( "Unknown multi tenancy strategy [ " +strategyName +" ], using MultiTenancyStrategy.NONE." );
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.cfg;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.AnnotationException;
|
import org.hibernate.AnnotationException;
|
||||||
|
@ -87,7 +88,7 @@ public class CopyIdentifierComponentSecondPass implements SecondPass {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//JPA 2 requires referencedColumnNames to be case insensitive
|
//JPA 2 requires referencedColumnNames to be case insensitive
|
||||||
columnByReferencedName.put( referencedColumnName.toLowerCase(), joinColumn );
|
columnByReferencedName.put( referencedColumnName.toLowerCase(Locale.ROOT), joinColumn );
|
||||||
}
|
}
|
||||||
//try default column orientation
|
//try default column orientation
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
@ -142,7 +143,7 @@ public class CopyIdentifierComponentSecondPass implements SecondPass {
|
||||||
final String columnName = column.getName();
|
final String columnName = column.getName();
|
||||||
logicalColumnName = mappings.getLogicalColumnName( columnName, referencedPersistentClass.getTable() );
|
logicalColumnName = mappings.getLogicalColumnName( columnName, referencedPersistentClass.getTable() );
|
||||||
//JPA 2 requires referencedColumnNames to be case insensitive
|
//JPA 2 requires referencedColumnNames to be case insensitive
|
||||||
joinColumn = columnByReferencedName.get( logicalColumnName.toLowerCase() );
|
joinColumn = columnByReferencedName.get( logicalColumnName.toLowerCase(Locale.ROOT ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
joinColumn = columnByReferencedName.get( "" + index );
|
joinColumn = columnByReferencedName.get( "" + index );
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package org.hibernate.cfg;
|
package org.hibernate.cfg;
|
||||||
|
import java.util.Locale;
|
||||||
import org.hibernate.AssertionFailure;
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ public class DefaultComponentSafeNamingStrategy extends EJB3NamingStrategy {
|
||||||
public static final NamingStrategy INSTANCE = new DefaultComponentSafeNamingStrategy();
|
public static final NamingStrategy INSTANCE = new DefaultComponentSafeNamingStrategy();
|
||||||
|
|
||||||
protected static String addUnderscores(String name) {
|
protected static String addUnderscores(String name) {
|
||||||
return name.replace( '.', '_' ).toLowerCase();
|
return name.replace( '.', '_' ).toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.cfg;
|
package org.hibernate.cfg;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
@ -79,7 +80,7 @@ public class ImprovedNamingStrategy implements NamingStrategy, Serializable {
|
||||||
buf.insert(i++, '_');
|
buf.insert(i++, '_');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buf.toString().toLowerCase();
|
return buf.toString().toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String collectionTableName(
|
public String collectionTableName(
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.cfg;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import javax.persistence.Index;
|
import javax.persistence.Index;
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ public class JPAIndexHolder {
|
||||||
private void initializeColumns(String[] columns, String[] ordering, List<String> list) {
|
private void initializeColumns(String[] columns, String[] ordering, List<String> list) {
|
||||||
for ( int i = 0, size = list.size(); i < size; i++ ) {
|
for ( int i = 0, size = list.size(); i < size; i++ ) {
|
||||||
final String description = list.get( i );
|
final String description = list.get( i );
|
||||||
final String tmp = description.toLowerCase();
|
final String tmp = description.toLowerCase(Locale.ROOT);
|
||||||
if ( tmp.endsWith( " desc" ) ) {
|
if ( tmp.endsWith( " desc" ) ) {
|
||||||
columns[i] = description.substring( 0, description.length() - 5 );
|
columns[i] = description.substring( 0, description.length() - 5 );
|
||||||
ordering[i] = "desc";
|
ordering[i] = "desc";
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package org.hibernate.cfg;
|
package org.hibernate.cfg;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
@ -60,7 +61,7 @@ public class VerifyFetchProfileReferenceSecondPass implements SecondPass {
|
||||||
clazz.getProperty( fetch.association() );
|
clazz.getProperty( fetch.association() );
|
||||||
|
|
||||||
profile.addFetch(
|
profile.addFetch(
|
||||||
fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase()
|
fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase(Locale.ROOT)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ package org.hibernate.cfg.annotations;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import javax.persistence.AttributeOverride;
|
import javax.persistence.AttributeOverride;
|
||||||
|
@ -461,23 +462,23 @@ public abstract class CollectionBinder {
|
||||||
Loader loader = property.getAnnotation( Loader.class );
|
Loader loader = property.getAnnotation( Loader.class );
|
||||||
if ( sqlInsert != null ) {
|
if ( sqlInsert != null ) {
|
||||||
collection.setCustomSQLInsert( sqlInsert.sql().trim(), sqlInsert.callable(),
|
collection.setCustomSQLInsert( sqlInsert.sql().trim(), sqlInsert.callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlInsert.check().toString().toLowerCase() )
|
ExecuteUpdateResultCheckStyle.fromExternalName( sqlInsert.check().toString().toLowerCase(Locale.ROOT) )
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
if ( sqlUpdate != null ) {
|
if ( sqlUpdate != null ) {
|
||||||
collection.setCustomSQLUpdate( sqlUpdate.sql(), sqlUpdate.callable(),
|
collection.setCustomSQLUpdate( sqlUpdate.sql(), sqlUpdate.callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlUpdate.check().toString().toLowerCase() )
|
ExecuteUpdateResultCheckStyle.fromExternalName( sqlUpdate.check().toString().toLowerCase(Locale.ROOT) )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( sqlDelete != null ) {
|
if ( sqlDelete != null ) {
|
||||||
collection.setCustomSQLDelete( sqlDelete.sql(), sqlDelete.callable(),
|
collection.setCustomSQLDelete( sqlDelete.sql(), sqlDelete.callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDelete.check().toString().toLowerCase() )
|
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDelete.check().toString().toLowerCase(Locale.ROOT) )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( sqlDeleteAll != null ) {
|
if ( sqlDeleteAll != null ) {
|
||||||
collection.setCustomSQLDeleteAll( sqlDeleteAll.sql(), sqlDeleteAll.callable(),
|
collection.setCustomSQLDeleteAll( sqlDeleteAll.sql(), sqlDeleteAll.callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDeleteAll.check().toString().toLowerCase() )
|
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDeleteAll.check().toString().toLowerCase(Locale.ROOT) )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( loader != null ) {
|
if ( loader != null ) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import javax.persistence.Access;
|
import javax.persistence.Access;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
|
@ -329,23 +330,23 @@ public class EntityBinder {
|
||||||
|
|
||||||
if ( sqlInsert != null ) {
|
if ( sqlInsert != null ) {
|
||||||
persistentClass.setCustomSQLInsert( sqlInsert.sql().trim(), sqlInsert.callable(),
|
persistentClass.setCustomSQLInsert( sqlInsert.sql().trim(), sqlInsert.callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlInsert.check().toString().toLowerCase() )
|
ExecuteUpdateResultCheckStyle.fromExternalName( sqlInsert.check().toString().toLowerCase(Locale.ROOT) )
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
if ( sqlUpdate != null ) {
|
if ( sqlUpdate != null ) {
|
||||||
persistentClass.setCustomSQLUpdate( sqlUpdate.sql(), sqlUpdate.callable(),
|
persistentClass.setCustomSQLUpdate( sqlUpdate.sql(), sqlUpdate.callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlUpdate.check().toString().toLowerCase() )
|
ExecuteUpdateResultCheckStyle.fromExternalName( sqlUpdate.check().toString().toLowerCase(Locale.ROOT) )
|
||||||
);
|
);Locale.ROOT
|
||||||
}
|
}
|
||||||
if ( sqlDelete != null ) {
|
if ( sqlDelete != null ) {
|
||||||
persistentClass.setCustomSQLDelete( sqlDelete.sql(), sqlDelete.callable(),
|
persistentClass.setCustomSQLDelete( sqlDelete.sql(), sqlDelete.callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDelete.check().toString().toLowerCase() )
|
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDelete.check().toString().toLowerCase(Locale.ROOT) )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( sqlDeleteAll != null ) {
|
if ( sqlDeleteAll != null ) {
|
||||||
persistentClass.setCustomSQLDelete( sqlDeleteAll.sql(), sqlDeleteAll.callable(),
|
persistentClass.setCustomSQLDelete( sqlDeleteAll.sql(), sqlDeleteAll.callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDeleteAll.check().toString().toLowerCase() )
|
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDeleteAll.check().toString().toLowerCase(Locale.ROOT) )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( loader != null ) {
|
if ( loader != null ) {
|
||||||
|
@ -864,7 +865,7 @@ public class EntityBinder {
|
||||||
join.setCustomSQLInsert( matchingTable.sqlInsert().sql().trim(),
|
join.setCustomSQLInsert( matchingTable.sqlInsert().sql().trim(),
|
||||||
matchingTable.sqlInsert().callable(),
|
matchingTable.sqlInsert().callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName(
|
ExecuteUpdateResultCheckStyle.fromExternalName(
|
||||||
matchingTable.sqlInsert().check().toString().toLowerCase()
|
matchingTable.sqlInsert().check().toString().toLowerCase(Locale.ROOT)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -872,7 +873,7 @@ public class EntityBinder {
|
||||||
join.setCustomSQLUpdate( matchingTable.sqlUpdate().sql().trim(),
|
join.setCustomSQLUpdate( matchingTable.sqlUpdate().sql().trim(),
|
||||||
matchingTable.sqlUpdate().callable(),
|
matchingTable.sqlUpdate().callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName(
|
ExecuteUpdateResultCheckStyle.fromExternalName(
|
||||||
matchingTable.sqlUpdate().check().toString().toLowerCase()
|
matchingTable.sqlUpdate().check().toString().toLowerCase(Locale.ROOT)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -880,7 +881,7 @@ public class EntityBinder {
|
||||||
join.setCustomSQLDelete( matchingTable.sqlDelete().sql().trim(),
|
join.setCustomSQLDelete( matchingTable.sqlDelete().sql().trim(),
|
||||||
matchingTable.sqlDelete().callable(),
|
matchingTable.sqlDelete().callable(),
|
||||||
ExecuteUpdateResultCheckStyle.fromExternalName(
|
ExecuteUpdateResultCheckStyle.fromExternalName(
|
||||||
matchingTable.sqlDelete().check().toString().toLowerCase()
|
matchingTable.sqlDelete().check().toString().toLowerCase(Locale.ROOT)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.Access;
|
import javax.persistence.Access;
|
||||||
|
@ -1980,7 +1981,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
||||||
parameterDescriptor.setValue( "mode", ParameterMode.IN );
|
parameterDescriptor.setValue( "mode", ParameterMode.IN );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
parameterDescriptor.setValue( "mode", ParameterMode.valueOf( modeValue.toUpperCase() ) );
|
parameterDescriptor.setValue( "mode", ParameterMode.valueOf( modeValue.toUpperCase(Locale.ROOT) ) );
|
||||||
}
|
}
|
||||||
String clazzName = parameterElement.attributeValue( "class" );
|
String clazzName = parameterElement.attributeValue( "class" );
|
||||||
Class clazz;
|
Class clazz;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.cfg.beanvalidation;
|
package org.hibernate.cfg.beanvalidation;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
@ -68,7 +69,7 @@ public enum ValidationMode {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
return valueOf( modeProperty.trim().toUpperCase() );
|
return valueOf( modeProperty.trim().toUpperCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
catch ( IllegalArgumentException e ) {
|
catch ( IllegalArgumentException e ) {
|
||||||
throw new HibernateException( "Unknown validation mode in " + BeanValidationIntegrator.MODE_PROPERTY + ": " + modeProperty );
|
throw new HibernateException( "Unknown validation mode in " + BeanValidationIntegrator.MODE_PROPERTY + ": " + modeProperty );
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
|
@ -289,7 +290,7 @@ public class Example implements Criterion {
|
||||||
if ( value instanceof String ) {
|
if ( value instanceof String ) {
|
||||||
String string = (String) value;
|
String string = (String) value;
|
||||||
if ( isIgnoreCaseEnabled ) {
|
if ( isIgnoreCaseEnabled ) {
|
||||||
string = string.toLowerCase();
|
string = string.toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
if ( isLikeEnabled ) {
|
if ( isLikeEnabled ) {
|
||||||
string = matchMode.toMatchString( string );
|
string = matchMode.toMatchString( string );
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.criterion;
|
package org.hibernate.criterion;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
@ -74,7 +75,7 @@ public class IlikeExpression implements Criterion {
|
||||||
criteriaQuery.getTypedValue(
|
criteriaQuery.getTypedValue(
|
||||||
criteria,
|
criteria,
|
||||||
propertyName,
|
propertyName,
|
||||||
value.toString().toLowerCase()
|
value.toString().toLowerCase(Locale.ROOT)
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
@ -132,7 +133,7 @@ public class Junction implements Criterion {
|
||||||
* @return SQL operator
|
* @return SQL operator
|
||||||
*/
|
*/
|
||||||
public String getOperator() {
|
public String getOperator() {
|
||||||
return name().toLowerCase();
|
return name().toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.criterion;
|
package org.hibernate.criterion;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
@ -94,7 +95,7 @@ public class LikeExpression implements Criterion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) {
|
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) {
|
||||||
final String matchValue = ignoreCase ? value.toString().toLowerCase() : value.toString();
|
final String matchValue = ignoreCase ? value.toString().toLowerCase(Locale.ROOT) : value.toString();
|
||||||
|
|
||||||
return new TypedValue[] { criteriaQuery.getTypedValue( criteria, propertyName, matchValue ) };
|
return new TypedValue[] { criteriaQuery.getTypedValue( criteria, propertyName, matchValue ) };
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.criterion;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
import org.hibernate.NullPrecedence;
|
import org.hibernate.NullPrecedence;
|
||||||
|
@ -167,6 +168,6 @@ public class Order implements Serializable {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return propertyName + ' '
|
return propertyName + ' '
|
||||||
+ ( ascending ? "asc" : "desc" )
|
+ ( ascending ? "asc" : "desc" )
|
||||||
+ ( nullPrecedence != null ? ' ' + nullPrecedence.name().toLowerCase() : "" );
|
+ ( nullPrecedence != null ? ' ' + nullPrecedence.name().toLowerCase(Locale.ROOT) : "" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.criterion;
|
package org.hibernate.criterion;
|
||||||
|
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
@ -111,7 +112,7 @@ public class SimpleExpression implements Criterion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
|
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
|
||||||
final Object casedValue = ignoreCase ? value.toString().toLowerCase() : value;
|
final Object casedValue = ignoreCase ? value.toString().toLowerCase(Locale.ROOT) : value;
|
||||||
return new TypedValue[] { criteriaQuery.getTypedValue( criteria, propertyName, casedValue ) };
|
return new TypedValue[] { criteriaQuery.getTypedValue( criteria, propertyName, casedValue ) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.dialect;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.dialect.function.AnsiTrimFunction;
|
import org.hibernate.dialect.function.AnsiTrimFunction;
|
||||||
|
@ -186,7 +187,7 @@ public class DerbyDialect extends DB2Dialect {
|
||||||
@Override
|
@Override
|
||||||
public String getLimitString(String query, final int offset, final int limit) {
|
public String getLimitString(String query, final int offset, final int limit) {
|
||||||
final StringBuilder sb = new StringBuilder(query.length() + 50);
|
final StringBuilder sb = new StringBuilder(query.length() + 50);
|
||||||
final String normalizedSelect = query.toLowerCase().trim();
|
final String normalizedSelect = query.toLowerCase(Locale.ROOT).trim();
|
||||||
final int forUpdateIndex = normalizedSelect.lastIndexOf( "for update") ;
|
final int forUpdateIndex = normalizedSelect.lastIndexOf( "for update") ;
|
||||||
|
|
||||||
if ( hasForUpdateClause( forUpdateIndex ) ) {
|
if ( hasForUpdateClause( forUpdateIndex ) ) {
|
||||||
|
|
|
@ -23,23 +23,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.dialect;
|
package org.hibernate.dialect;
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.sql.Blob;
|
|
||||||
import java.sql.CallableStatement;
|
|
||||||
import java.sql.Clob;
|
|
||||||
import java.sql.NClob;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Types;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.LockOptions;
|
import org.hibernate.LockOptions;
|
||||||
|
@ -92,9 +75,26 @@ import org.hibernate.sql.JoinFragment;
|
||||||
import org.hibernate.type.StandardBasicTypes;
|
import org.hibernate.type.StandardBasicTypes;
|
||||||
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
|
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
|
||||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.sql.Blob;
|
||||||
|
import java.sql.CallableStatement;
|
||||||
|
import java.sql.Clob;
|
||||||
|
import java.sql.NClob;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Types;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a dialect of SQL implemented by a particular RDBMS. Subclasses implement Hibernate compatibility
|
* Represents a dialect of SQL implemented by a particular RDBMS. Subclasses implement Hibernate compatibility
|
||||||
* with different systems. Subclasses should provide a public default constructor that register a set of type
|
* with different systems. Subclasses should provide a public default constructor that register a set of type
|
||||||
|
@ -692,7 +692,7 @@ public abstract class Dialect implements ConversionContext {
|
||||||
protected void registerFunction(String name, SQLFunction function) {
|
protected void registerFunction(String name, SQLFunction function) {
|
||||||
// HHH-7721: SQLFunctionRegistry expects all lowercase. Enforce,
|
// HHH-7721: SQLFunctionRegistry expects all lowercase. Enforce,
|
||||||
// just in case a user's customer dialect uses mixed cases.
|
// just in case a user's customer dialect uses mixed cases.
|
||||||
sqlFunctions.put( name.toLowerCase(), function );
|
sqlFunctions.put( name.toLowerCase(Locale.ROOT), function );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2370,7 +2370,7 @@ public abstract class Dialect implements ConversionContext {
|
||||||
orderByElement.append( " " ).append( order );
|
orderByElement.append( " " ).append( order );
|
||||||
}
|
}
|
||||||
if ( nulls != NullPrecedence.NONE ) {
|
if ( nulls != NullPrecedence.NONE ) {
|
||||||
orderByElement.append( " nulls " ).append( nulls.name().toLowerCase() );
|
orderByElement.append( " nulls " ).append( nulls.name().toLowerCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
return orderByElement.toString();
|
return orderByElement.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.dialect;
|
package org.hibernate.dialect;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Types;
|
|
||||||
|
|
||||||
import org.hibernate.JDBCException;
|
import org.hibernate.JDBCException;
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
@ -52,9 +48,13 @@ import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||||
import org.hibernate.internal.util.ReflectHelper;
|
import org.hibernate.internal.util.ReflectHelper;
|
||||||
import org.hibernate.persister.entity.Lockable;
|
import org.hibernate.persister.entity.Lockable;
|
||||||
import org.hibernate.type.StandardBasicTypes;
|
import org.hibernate.type.StandardBasicTypes;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An SQL dialect compatible with HSQLDB (HyperSQL).
|
* An SQL dialect compatible with HSQLDB (HyperSQL).
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -278,7 +278,7 @@ public class HSQLDialect extends Dialect {
|
||||||
return new StringBuilder( sql.length() + 10 )
|
return new StringBuilder( sql.length() + 10 )
|
||||||
.append( sql )
|
.append( sql )
|
||||||
.insert(
|
.insert(
|
||||||
sql.toLowerCase().indexOf( "select" ) + 6,
|
sql.toLowerCase(Locale.ROOT).indexOf( "select" ) + 6,
|
||||||
hasOffset ? " limit ? ?" : " top ?"
|
hasOffset ? " limit ? ?" : " top ?"
|
||||||
)
|
)
|
||||||
.toString();
|
.toString();
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.dialect;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.dialect.function.VarArgsSQLFunction;
|
import org.hibernate.dialect.function.VarArgsSQLFunction;
|
||||||
|
@ -212,7 +213,7 @@ public class InformixDialect extends Dialect {
|
||||||
}
|
}
|
||||||
return new StringBuilder( querySelect.length() + 8 )
|
return new StringBuilder( querySelect.length() + 8 )
|
||||||
.append( querySelect )
|
.append( querySelect )
|
||||||
.insert( querySelect.toLowerCase().indexOf( "select" ) + 6, " first " + limit )
|
.insert( querySelect.toLowerCase(Locale.ROOT).indexOf( "select" ) + 6, " first " + limit )
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.dialect;
|
package org.hibernate.dialect;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||||
|
@ -88,7 +89,7 @@ public class InterbaseDialect extends Dialect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDropSequenceString(String sequenceName) {
|
public String getDropSequenceString(String sequenceName) {
|
||||||
return "delete from RDB$GENERATORS where RDB$GENERATOR_NAME = '" + sequenceName.toUpperCase() + "'";
|
return "delete from RDB$GENERATORS where RDB$GENERATOR_NAME = '" + sequenceName.toUpperCase(Locale.ROOT) + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.JDBCException;
|
import org.hibernate.JDBCException;
|
||||||
import org.hibernate.QueryTimeoutException;
|
import org.hibernate.QueryTimeoutException;
|
||||||
|
@ -62,6 +63,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class Oracle8iDialect extends Dialect {
|
public class Oracle8iDialect extends Dialect {
|
||||||
|
|
||||||
private static final int PARAM_LIST_SIZE_LIMIT = 1000;
|
private static final int PARAM_LIST_SIZE_LIMIT = 1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -247,7 +249,7 @@ public class Oracle8iDialect extends Dialect {
|
||||||
public String getLimitString(String sql, boolean hasOffset) {
|
public String getLimitString(String sql, boolean hasOffset) {
|
||||||
sql = sql.trim();
|
sql = sql.trim();
|
||||||
boolean isForUpdate = false;
|
boolean isForUpdate = false;
|
||||||
if ( sql.toLowerCase().endsWith( " for update" ) ) {
|
if ( sql.toLowerCase(Locale.ROOT).endsWith( " for update" ) ) {
|
||||||
sql = sql.substring( 0, sql.length()-11 );
|
sql = sql.substring( 0, sql.length()-11 );
|
||||||
isForUpdate = true;
|
isForUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.sql.CallableStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||||
|
@ -242,7 +243,7 @@ public class Oracle9Dialect extends Dialect {
|
||||||
|
|
||||||
sql = sql.trim();
|
sql = sql.trim();
|
||||||
boolean isForUpdate = false;
|
boolean isForUpdate = false;
|
||||||
if ( sql.toLowerCase().endsWith( " for update" ) ) {
|
if ( sql.toLowerCase(Locale.ROOT).endsWith( " for update" ) ) {
|
||||||
sql = sql.substring( 0, sql.length() - 11 );
|
sql = sql.substring( 0, sql.length() - 11 );
|
||||||
isForUpdate = true;
|
isForUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.dialect;
|
package org.hibernate.dialect;
|
||||||
|
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.LockOptions;
|
import org.hibernate.LockOptions;
|
||||||
import org.hibernate.sql.ANSICaseFragment;
|
import org.hibernate.sql.ANSICaseFragment;
|
||||||
|
@ -37,6 +38,7 @@ import org.hibernate.sql.CaseFragment;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class Oracle9iDialect extends Oracle8iDialect {
|
public class Oracle9iDialect extends Oracle8iDialect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerCharacterTypeMappings() {
|
protected void registerCharacterTypeMappings() {
|
||||||
registerColumnType( Types.CHAR, "char(1 char)" );
|
registerColumnType( Types.CHAR, "char(1 char)" );
|
||||||
|
@ -62,7 +64,7 @@ public class Oracle9iDialect extends Oracle8iDialect {
|
||||||
sql = sql.trim();
|
sql = sql.trim();
|
||||||
String forUpdateClause = null;
|
String forUpdateClause = null;
|
||||||
boolean isForUpdate = false;
|
boolean isForUpdate = false;
|
||||||
final int forUpdateIndex = sql.toLowerCase().lastIndexOf( "for update") ;
|
final int forUpdateIndex = sql.toLowerCase(Locale.ROOT).lastIndexOf( "for update") ;
|
||||||
if ( forUpdateIndex > -1 ) {
|
if ( forUpdateIndex > -1 ) {
|
||||||
// save 'for update ...' and then remove it
|
// save 'for update ...' and then remove it
|
||||||
forUpdateClause = sql.substring( forUpdateIndex );
|
forUpdateClause = sql.substring( forUpdateIndex );
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.dialect;
|
package org.hibernate.dialect;
|
||||||
|
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.sql.CaseFragment;
|
import org.hibernate.sql.CaseFragment;
|
||||||
|
@ -75,7 +76,7 @@ public class OracleDialect extends Oracle9Dialect {
|
||||||
|
|
||||||
sql = sql.trim();
|
sql = sql.trim();
|
||||||
boolean isForUpdate = false;
|
boolean isForUpdate = false;
|
||||||
if ( sql.toLowerCase().endsWith( " for update" ) ) {
|
if ( sql.toLowerCase(Locale.ROOT).endsWith( " for update" ) ) {
|
||||||
sql = sql.substring( 0, sql.length()-11 );
|
sql = sql.substring( 0, sql.length()-11 );
|
||||||
isForUpdate = true;
|
isForUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.dialect;
|
package org.hibernate.dialect;
|
||||||
|
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.LockOptions;
|
import org.hibernate.LockOptions;
|
||||||
|
@ -73,8 +74,8 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getAfterSelectInsertPoint(String sql) {
|
static int getAfterSelectInsertPoint(String sql) {
|
||||||
final int selectIndex = sql.toLowerCase().indexOf( "select" );
|
final int selectIndex = sql.toLowerCase(Locale.ROOT).indexOf( "select" );
|
||||||
final int selectDistinctIndex = sql.toLowerCase().indexOf( "select distinct" );
|
final int selectDistinctIndex = sql.toLowerCase(Locale.ROOT).indexOf( "select distinct" );
|
||||||
return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
|
return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.dialect.function;
|
package org.hibernate.dialect.function;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
@ -56,7 +57,7 @@ public class SQLFunctionRegistry {
|
||||||
* @return The located function, maye return {@code null}
|
* @return The located function, maye return {@code null}
|
||||||
*/
|
*/
|
||||||
public SQLFunction findSQLFunction(String functionName) {
|
public SQLFunction findSQLFunction(String functionName) {
|
||||||
final String name = functionName.toLowerCase();
|
final String name = functionName.toLowerCase(Locale.ROOT);
|
||||||
final SQLFunction userFunction = userFunctions.get( name );
|
final SQLFunction userFunction = userFunctions.get( name );
|
||||||
return userFunction != null
|
return userFunction != null
|
||||||
? userFunction
|
? userFunction
|
||||||
|
@ -72,7 +73,7 @@ public class SQLFunctionRegistry {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("UnusedDeclaration")
|
@SuppressWarnings("UnusedDeclaration")
|
||||||
public boolean hasFunction(String functionName) {
|
public boolean hasFunction(String functionName) {
|
||||||
final String name = functionName.toLowerCase();
|
final String name = functionName.toLowerCase(Locale.ROOT);
|
||||||
return userFunctions.containsKey( name ) || dialect.getFunctions().containsKey( name );
|
return userFunctions.containsKey( name ) || dialect.getFunctions().containsKey( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -302,7 +303,7 @@ public class SQLServer2005LimitHandler extends AbstractLimitHandler {
|
||||||
*/
|
*/
|
||||||
private static int shallowIndexOf(StringBuilder sb, String search, int fromIndex) {
|
private static int shallowIndexOf(StringBuilder sb, String search, int fromIndex) {
|
||||||
// case-insensitive match
|
// case-insensitive match
|
||||||
final String lowercase = sb.toString().toLowerCase();
|
final String lowercase = sb.toString().toLowerCase(Locale.ROOT);
|
||||||
final int len = lowercase.length();
|
final int len = lowercase.length();
|
||||||
final int searchlen = search.length();
|
final int searchlen = search.length();
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.engine.jdbc.internal;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
@ -126,7 +127,7 @@ public class BasicFormatterImpl implements Formatter {
|
||||||
|
|
||||||
while ( tokens.hasMoreTokens() ) {
|
while ( tokens.hasMoreTokens() ) {
|
||||||
token = tokens.nextToken();
|
token = tokens.nextToken();
|
||||||
lcToken = token.toLowerCase();
|
lcToken = token.toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
if ( "'".equals( token ) ) {
|
if ( "'".equals( token ) ) {
|
||||||
String t;
|
String t;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.engine.jdbc.internal;
|
package org.hibernate.engine.jdbc.internal;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
@ -44,13 +45,13 @@ public class DDLFormatterImpl implements Formatter {
|
||||||
if ( StringHelper.isEmpty( sql ) ) {
|
if ( StringHelper.isEmpty( sql ) ) {
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
if ( sql.toLowerCase().startsWith( "create table" ) ) {
|
if ( sql.toLowerCase(Locale.ROOT).startsWith( "create table" ) ) {
|
||||||
return formatCreateTable( sql );
|
return formatCreateTable( sql );
|
||||||
}
|
}
|
||||||
else if ( sql.toLowerCase().startsWith( "alter table" ) ) {
|
else if ( sql.toLowerCase(Locale.ROOT).startsWith( "alter table" ) ) {
|
||||||
return formatAlterTable( sql );
|
return formatAlterTable( sql );
|
||||||
}
|
}
|
||||||
else if ( sql.toLowerCase().startsWith( "comment on" ) ) {
|
else if ( sql.toLowerCase(Locale.ROOT).startsWith( "comment on" ) ) {
|
||||||
return formatCommentOn( sql );
|
return formatCommentOn( sql );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.hql.internal;
|
package org.hibernate.hql.internal;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.persister.collection.CollectionPropertyNames;
|
import org.hibernate.persister.collection.CollectionPropertyNames;
|
||||||
|
@ -36,17 +37,17 @@ import org.hibernate.persister.collection.CollectionPropertyNames;
|
||||||
public final class CollectionProperties {
|
public final class CollectionProperties {
|
||||||
public static final Map HQL_COLLECTION_PROPERTIES;
|
public static final Map HQL_COLLECTION_PROPERTIES;
|
||||||
|
|
||||||
private static final String COLLECTION_INDEX_LOWER = CollectionPropertyNames.COLLECTION_INDEX.toLowerCase();
|
private static final String COLLECTION_INDEX_LOWER = CollectionPropertyNames.COLLECTION_INDEX.toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
HQL_COLLECTION_PROPERTIES = new HashMap();
|
HQL_COLLECTION_PROPERTIES = new HashMap();
|
||||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_ELEMENTS.toLowerCase(), CollectionPropertyNames.COLLECTION_ELEMENTS );
|
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_ELEMENTS.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_ELEMENTS );
|
||||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_INDICES.toLowerCase(), CollectionPropertyNames.COLLECTION_INDICES );
|
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_INDICES.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_INDICES );
|
||||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_SIZE.toLowerCase(), CollectionPropertyNames.COLLECTION_SIZE );
|
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_SIZE.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_SIZE );
|
||||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MAX_INDEX.toLowerCase(), CollectionPropertyNames.COLLECTION_MAX_INDEX );
|
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MAX_INDEX.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_MAX_INDEX );
|
||||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MIN_INDEX.toLowerCase(), CollectionPropertyNames.COLLECTION_MIN_INDEX );
|
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MIN_INDEX.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_MIN_INDEX );
|
||||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MAX_ELEMENT.toLowerCase(), CollectionPropertyNames.COLLECTION_MAX_ELEMENT );
|
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MAX_ELEMENT.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_MAX_ELEMENT );
|
||||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MIN_ELEMENT.toLowerCase(), CollectionPropertyNames.COLLECTION_MIN_ELEMENT );
|
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MIN_ELEMENT.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_MIN_ELEMENT );
|
||||||
HQL_COLLECTION_PROPERTIES.put( COLLECTION_INDEX_LOWER, CollectionPropertyNames.COLLECTION_INDEX );
|
HQL_COLLECTION_PROPERTIES.put( COLLECTION_INDEX_LOWER, CollectionPropertyNames.COLLECTION_INDEX );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ public final class CollectionProperties {
|
||||||
|
|
||||||
@SuppressWarnings("SimplifiableIfStatement")
|
@SuppressWarnings("SimplifiableIfStatement")
|
||||||
public static boolean isCollectionProperty(String name) {
|
public static boolean isCollectionProperty(String name) {
|
||||||
final String key = name.toLowerCase();
|
final String key = name.toLowerCase(Locale.ROOT);
|
||||||
// CollectionPropertyMapping processes everything except 'index'.
|
// CollectionPropertyMapping processes everything except 'index'.
|
||||||
if ( COLLECTION_INDEX_LOWER.equals( key ) ) {
|
if ( COLLECTION_INDEX_LOWER.equals( key ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -70,7 +71,7 @@ public final class CollectionProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAnyCollectionProperty(String name) {
|
public static boolean isAnyCollectionProperty(String name) {
|
||||||
final String key = name.toLowerCase();
|
final String key = name.toLowerCase(Locale.ROOT);
|
||||||
return HQL_COLLECTION_PROPERTIES.containsKey( key );
|
return HQL_COLLECTION_PROPERTIES.containsKey( key );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ package org.hibernate.hql.internal;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
@ -89,7 +90,7 @@ public final class QuerySplitter {
|
||||||
int start = getStartingPositionFor( tokens, templateQuery );
|
int start = getStartingPositionFor( tokens, templateQuery );
|
||||||
int count = 0;
|
int count = 0;
|
||||||
String next;
|
String next;
|
||||||
String last = tokens[start - 1].toLowerCase();
|
String last = tokens[start - 1].toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
for ( int i = start; i < tokens.length; i++ ) {
|
for ( int i = start; i < tokens.length; i++ ) {
|
||||||
|
|
||||||
|
@ -100,12 +101,12 @@ public final class QuerySplitter {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
next = nextNonWhite( tokens, i ).toLowerCase();
|
next = nextNonWhite( tokens, i ).toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
boolean process = isJavaIdentifier( token ) &&
|
boolean process = isJavaIdentifier( token ) &&
|
||||||
isPossiblyClassName( last, next );
|
isPossiblyClassName( last, next );
|
||||||
|
|
||||||
last = token.toLowerCase();
|
last = token.toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
if ( process ) {
|
if ( process ) {
|
||||||
String importedClassName = getImportedClass( token, factory );
|
String importedClassName = getImportedClass( token, factory );
|
||||||
|
@ -144,13 +145,13 @@ public final class QuerySplitter {
|
||||||
|
|
||||||
private static int getStartingPositionFor(String[] tokens, StringBuilder templateQuery) {
|
private static int getStartingPositionFor(String[] tokens, StringBuilder templateQuery) {
|
||||||
templateQuery.append( tokens[0] );
|
templateQuery.append( tokens[0] );
|
||||||
if ( !"select".equals( tokens[0].toLowerCase() ) ) {
|
if ( !"select".equals( tokens[0].toLowerCase(Locale.ROOT) ) ) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// select-range is terminated by declaration of "from"
|
// select-range is terminated by declaration of "from"
|
||||||
for ( int i = 1; i < tokens.length; i++ ) {
|
for ( int i = 1; i < tokens.length; i++ ) {
|
||||||
if ( "from".equals( tokens[i].toLowerCase() ) ) {
|
if ( "from".equals( tokens[i].toLowerCase(Locale.ROOT) ) ) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
templateQuery.append( tokens[i] );
|
templateQuery.append( tokens[i] );
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.hibernate.type.Type;
|
||||||
|
|
||||||
import antlr.SemanticException;
|
import antlr.SemanticException;
|
||||||
import antlr.collections.AST;
|
import antlr.collections.AST;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a constructor (new) in a SELECT.
|
* Represents a constructor (new) in a SELECT.
|
||||||
|
@ -146,11 +147,11 @@ public class ConstructorNode extends SelectExpressionList implements AggregatedS
|
||||||
public void prepare() throws SemanticException {
|
public void prepare() throws SemanticException {
|
||||||
constructorArgumentTypes = resolveConstructorArgumentTypes();
|
constructorArgumentTypes = resolveConstructorArgumentTypes();
|
||||||
String path = ( (PathNode) getFirstChild() ).getPath();
|
String path = ( (PathNode) getFirstChild() ).getPath();
|
||||||
if ( "map".equals( path.toLowerCase() ) ) {
|
if ( "map".equals( path.toLowerCase(Locale.ROOT) ) ) {
|
||||||
isMap = true;
|
isMap = true;
|
||||||
resultType = Map.class;
|
resultType = Map.class;
|
||||||
}
|
}
|
||||||
else if ( "list".equals( path.toLowerCase() ) ) {
|
else if ( "list".equals( path.toLowerCase(Locale.ROOT) ) ) {
|
||||||
isList = true;
|
isList = true;
|
||||||
resultType = List.class;
|
resultType = List.class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import antlr.SemanticException;
|
import antlr.SemanticException;
|
||||||
import antlr.collections.AST;
|
import antlr.collections.AST;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a method call.
|
* Represents a method call.
|
||||||
|
@ -109,7 +110,7 @@ public class MethodNode extends AbstractSelectExpression implements FunctionNode
|
||||||
name.setType( SqlTokenTypes.METHOD_NAME );
|
name.setType( SqlTokenTypes.METHOD_NAME );
|
||||||
String text = name.getText();
|
String text = name.getText();
|
||||||
// Use the lower case function name.
|
// Use the lower case function name.
|
||||||
methodName = text.toLowerCase();
|
methodName = text.toLowerCase(Locale.ROOT);
|
||||||
// Remember whether we're in a SELECT clause or not.
|
// Remember whether we're in a SELECT clause or not.
|
||||||
this.inSelect = inSelect;
|
this.inSelect = inSelect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import antlr.SemanticException;
|
import antlr.SemanticException;
|
||||||
import antlr.collections.AST;
|
import antlr.collections.AST;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A delegate that handles literals and constants for HqlSqlWalker, performing the token replacement functions and
|
* A delegate that handles literals and constants for HqlSqlWalker, performing the token replacement functions and
|
||||||
|
@ -207,7 +208,7 @@ public class LiteralProcessor implements HqlSqlTokenTypes {
|
||||||
constant.setText( replacement );
|
constant.setText( replacement );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
boolean bool = "true".equals( constant.getText().toLowerCase() );
|
boolean bool = "true".equals( constant.getText().toLowerCase(Locale.ROOT) );
|
||||||
Dialect dialect = walker.getSessionFactoryHelper().getFactory().getDialect();
|
Dialect dialect = walker.getSessionFactoryHelper().getFactory().getDialect();
|
||||||
constant.setText( dialect.toBooleanValueString( bool ) );
|
constant.setText( dialect.toBooleanValueString( bool ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.hql.internal.classic;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.QueryException;
|
import org.hibernate.QueryException;
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ public class ClauseParser implements Parser {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
||||||
String lcToken = token.toLowerCase();
|
String lcToken = token.toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
if ( "(".equals( token ) ) {
|
if ( "(".equals( token ) ) {
|
||||||
parenCount++;
|
parenCount++;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.hql.internal.classic;
|
package org.hibernate.hql.internal.classic;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.QueryException;
|
import org.hibernate.QueryException;
|
||||||
|
@ -70,7 +71,7 @@ public class FromParser implements Parser {
|
||||||
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
||||||
|
|
||||||
// start by looking for HQL keywords...
|
// start by looking for HQL keywords...
|
||||||
String lcToken = token.toLowerCase();
|
String lcToken = token.toLowerCase(Locale.ROOT);
|
||||||
if ( lcToken.equals( "," ) ) {
|
if ( lcToken.equals( "," ) ) {
|
||||||
if ( !( expectingJoin | expectingAs ) ) throw new QueryException( "unexpected token: ," );
|
if ( !( expectingJoin | expectingAs ) ) throw new QueryException( "unexpected token: ," );
|
||||||
expectingJoin = false;
|
expectingJoin = false;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package org.hibernate.hql.internal.classic;
|
package org.hibernate.hql.internal.classic;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ public class PreprocessingParser implements Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String prop = CollectionProperties.getNormalizedPropertyName( token.toLowerCase() );
|
String prop = CollectionProperties.getNormalizedPropertyName( token.toLowerCase(Locale.ROOT) );
|
||||||
if ( prop != null ) {
|
if ( prop != null ) {
|
||||||
currentCollectionProp = prop;
|
currentCollectionProp = prop;
|
||||||
return;
|
return;
|
||||||
|
@ -123,7 +124,7 @@ public class PreprocessingParser implements Parser {
|
||||||
String doubleToken = ( token.length() > 1 ) ?
|
String doubleToken = ( token.length() > 1 ) ?
|
||||||
lastToken + ' ' + token :
|
lastToken + ' ' + token :
|
||||||
lastToken + token;
|
lastToken + token;
|
||||||
if ( HQL_OPERATORS.contains( doubleToken.toLowerCase() ) ) {
|
if ( HQL_OPERATORS.contains( doubleToken.toLowerCase(Locale.ROOT) ) ) {
|
||||||
parser.token( doubleToken, q );
|
parser.token( doubleToken, q );
|
||||||
lastToken = null;
|
lastToken = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -750,7 +751,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
||||||
parenCount--;
|
parenCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
String lc = token.toLowerCase();
|
String lc = token.toLowerCase(Locale.ROOT);
|
||||||
if ( lc.equals( ", " ) ) {
|
if ( lc.equals( ", " ) ) {
|
||||||
if ( nolast ) {
|
if ( nolast ) {
|
||||||
nolast = false;
|
nolast = false;
|
||||||
|
|
|
@ -26,6 +26,7 @@ package org.hibernate.hql.internal.classic;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.QueryException;
|
import org.hibernate.QueryException;
|
||||||
|
@ -75,7 +76,7 @@ public class SelectParser implements Parser {
|
||||||
|
|
||||||
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
||||||
|
|
||||||
String lctoken = token.toLowerCase();
|
String lctoken = token.toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
if ( first ) {
|
if ( first ) {
|
||||||
first = false;
|
first = false;
|
||||||
|
|
|
@ -27,6 +27,7 @@ package org.hibernate.hql.internal.classic;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
@ -210,7 +211,7 @@ public class WhereParser implements Parser {
|
||||||
|
|
||||||
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
||||||
|
|
||||||
String lcToken = token.toLowerCase();
|
String lcToken = token.toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
//Cope with [,]
|
//Cope with [,]
|
||||||
if ( token.equals( "[" ) && !expectingPathContinuation ) {
|
if ( token.equals( "[" ) && !expectingPathContinuation ) {
|
||||||
|
@ -441,7 +442,7 @@ public class WhereParser implements Parser {
|
||||||
}
|
}
|
||||||
else { //anything else
|
else { //anything else
|
||||||
|
|
||||||
String negatedToken = negated ? ( String ) NEGATIONS.get( token.toLowerCase() ) : null;
|
String negatedToken = negated ? ( String ) NEGATIONS.get( token.toLowerCase(Locale.ROOT) ) : null;
|
||||||
if ( negatedToken != null && ( !betweenSpecialCase || !"or".equals( negatedToken ) ) ) {
|
if ( negatedToken != null && ( !betweenSpecialCase || !"or".equals( negatedToken ) ) ) {
|
||||||
appendToken( q, negatedToken );
|
appendToken( q, negatedToken );
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,7 +352,7 @@ public final class StringHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean booleanValue(String tfString) {
|
public static boolean booleanValue(String tfString) {
|
||||||
String trimmed = tfString.trim().toLowerCase();
|
String trimmed = tfString.trim().toLowerCase(Locale.ROOT);
|
||||||
return trimmed.equals( "true" ) || trimmed.equals( "t" );
|
return trimmed.equals( "true" ) || trimmed.equals( "t" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ public final class StringHelper {
|
||||||
String result = truncate( unqualifyEntityName(description), ALIAS_TRUNCATE_LENGTH )
|
String result = truncate( unqualifyEntityName(description), ALIAS_TRUNCATE_LENGTH )
|
||||||
// Important to use Locale.ENGLISH. See HHH-8579. #toLowerCase() uses the default Locale. Certain DBs
|
// Important to use Locale.ENGLISH. See HHH-8579. #toLowerCase() uses the default Locale. Certain DBs
|
||||||
// do not like non-ascii characters in aliases, etc., so ensure consistency/portability here.
|
// do not like non-ascii characters in aliases, etc., so ensure consistency/portability here.
|
||||||
.toLowerCase(Locale.ENGLISH)
|
.toLowerCase(Locale.ROOT)
|
||||||
.replace( '/', '_' ) // entityNames may now include slashes for the representations
|
.replace( '/', '_' ) // entityNames may now include slashes for the representations
|
||||||
.replace( '$', '_' ); //classname may be an inner class
|
.replace( '$', '_' ); //classname may be an inner class
|
||||||
result = cleanAlias( result );
|
result = cleanAlias( result );
|
||||||
|
@ -593,13 +593,13 @@ public final class StringHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toUpperCase(String str) {
|
public static String toUpperCase(String str) {
|
||||||
return str==null ? null : str.toUpperCase();
|
return str==null ? null : str.toUpperCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toLowerCase(String str) {
|
public static String toLowerCase(String str) {
|
||||||
// Important to use Locale.ENGLISH. See HHH-8579. #toLowerCase() uses the default Locale. Certain DBs do not
|
// Important to use Locale.ENGLISH. See HHH-8579. #toLowerCase() uses the default Locale. Certain DBs do not
|
||||||
// like non-ascii characters in aliases, etc., so ensure consistency/portability here.
|
// like non-ascii characters in aliases, etc., so ensure consistency/portability here.
|
||||||
return str == null ? null : str.toLowerCase(Locale.ENGLISH);
|
return str == null ? null : str.toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String moveAndToBeginning(String filter) {
|
public static String moveAndToBeginning(String filter) {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.loader;
|
package org.hibernate.loader;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +61,7 @@ public enum BatchFetchStyle {
|
||||||
private static final Logger log = Logger.getLogger( BatchFetchStyle.class );
|
private static final Logger log = Logger.getLogger( BatchFetchStyle.class );
|
||||||
|
|
||||||
public static BatchFetchStyle byName(String name) {
|
public static BatchFetchStyle byName(String name) {
|
||||||
return valueOf( name.toUpperCase() );
|
return valueOf( name.toUpperCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BatchFetchStyle interpret(Object setting) {
|
public static BatchFetchStyle interpret(Object setting) {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
@ -122,7 +123,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean useRawName = name.length() + suffix.length() <= dialect.getMaxAliasLength()
|
boolean useRawName = name.length() + suffix.length() <= dialect.getMaxAliasLength()
|
||||||
&& !quoted && !name.toLowerCase().equals( "rowid" );
|
&& !quoted && !name.toLowerCase(Locale.ROOT).equals( "rowid" );
|
||||||
if ( !useRawName ) {
|
if ( !useRawName ) {
|
||||||
if ( suffix.length() >= dialect.getMaxAliasLength() ) {
|
if ( suffix.length() >= dialect.getMaxAliasLength() ) {
|
||||||
throw new MappingException( String.format(
|
throw new MappingException( String.format(
|
||||||
|
@ -168,7 +169,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
||||||
//used also for generation of FK names!
|
//used also for generation of FK names!
|
||||||
return isQuoted() ?
|
return isQuoted() ?
|
||||||
name.hashCode() :
|
name.hashCode() :
|
||||||
name.toLowerCase().hashCode();
|
name.toLowerCase(Locale.ROOT).hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -345,7 +346,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCanonicalName() {
|
public String getCanonicalName() {
|
||||||
return quoted ? name : name.toLowerCase();
|
return quoted ? name : name.toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
@ -365,15 +366,15 @@ public class Table implements RelationalModel, Serializable {
|
||||||
throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
|
throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final boolean typesMatch = col.getSqlType( dialect, mapping ).toLowerCase()
|
final boolean typesMatch = col.getSqlType( dialect, mapping ).toLowerCase(Locale.ROOT)
|
||||||
.startsWith( columnInfo.getTypeName().toLowerCase() )
|
.startsWith( columnInfo.getTypeName().toLowerCase(Locale.ROOT) )
|
||||||
|| columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
|
|| columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
|
||||||
if ( !typesMatch ) {
|
if ( !typesMatch ) {
|
||||||
throw new HibernateException(
|
throw new HibernateException(
|
||||||
"Wrong column type in " +
|
"Wrong column type in " +
|
||||||
Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()) +
|
Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()) +
|
||||||
" for column " + col.getName() +
|
" for column " + col.getName() +
|
||||||
". Found: " + columnInfo.getTypeName().toLowerCase() +
|
". Found: " + columnInfo.getTypeName().toLowerCase(Locale.ROOT) +
|
||||||
", expected: " + col.getSqlType( dialect, mapping )
|
", expected: " + col.getSqlType( dialect, mapping )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ package org.hibernate.sql;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@ public final class Template {
|
||||||
String nextToken = hasMore ? tokens.nextToken() : null;
|
String nextToken = hasMore ? tokens.nextToken() : null;
|
||||||
while ( hasMore ) {
|
while ( hasMore ) {
|
||||||
String token = nextToken;
|
String token = nextToken;
|
||||||
String lcToken = token.toLowerCase();
|
String lcToken = token.toLowerCase(Locale.ROOT);
|
||||||
hasMore = tokens.hasMoreTokens();
|
hasMore = tokens.hasMoreTokens();
|
||||||
nextToken = hasMore ? tokens.nextToken() : null;
|
nextToken = hasMore ? tokens.nextToken() : null;
|
||||||
|
|
||||||
|
@ -378,7 +379,7 @@ public final class Template {
|
||||||
// String nextToken = hasMore ? tokens.nextToken() : null;
|
// String nextToken = hasMore ? tokens.nextToken() : null;
|
||||||
// while ( hasMore ) {
|
// while ( hasMore ) {
|
||||||
// String token = nextToken;
|
// String token = nextToken;
|
||||||
// String lcToken = token.toLowerCase();
|
// String lcToken = token.toLowerCase(Locale.ROOT);
|
||||||
// hasMore = tokens.hasMoreTokens();
|
// hasMore = tokens.hasMoreTokens();
|
||||||
// nextToken = hasMore ? tokens.nextToken() : null;
|
// nextToken = hasMore ? tokens.nextToken() : null;
|
||||||
//
|
//
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.tool.hbm2ddl;
|
package org.hibernate.tool.hbm2ddl;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +62,7 @@ public enum UniqueConstraintSchemaUpdateStrategy {
|
||||||
private static final Logger log = Logger.getLogger( UniqueConstraintSchemaUpdateStrategy.class );
|
private static final Logger log = Logger.getLogger( UniqueConstraintSchemaUpdateStrategy.class );
|
||||||
|
|
||||||
public static UniqueConstraintSchemaUpdateStrategy byName(String name) {
|
public static UniqueConstraintSchemaUpdateStrategy byName(String name) {
|
||||||
return valueOf( name.toUpperCase() );
|
return valueOf( name.toUpperCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniqueConstraintSchemaUpdateStrategy interpret(Object setting) {
|
public static UniqueConstraintSchemaUpdateStrategy interpret(Object setting) {
|
||||||
|
|
|
@ -23,13 +23,14 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.dialect;
|
package org.hibernate.dialect;
|
||||||
|
|
||||||
|
import org.hibernate.engine.spi.RowSelection;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.RowSelection;
|
import java.util.Locale;
|
||||||
import org.hibernate.testing.TestForIssue;
|
|
||||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase {
|
||||||
"with query as (select inner_query.*, row_number() over (order by current_timestamp) as __hibernate_row_nr__ from ( " +
|
"with query as (select inner_query.*, row_number() over (order by current_timestamp) as __hibernate_row_nr__ from ( " +
|
||||||
"select distinct top(?) f1 as f53245 from table849752 order by f234, f67 desc ) inner_query )" +
|
"select distinct top(?) f1 as f53245 from table849752 order by f234, f67 desc ) inner_query )" +
|
||||||
" select f53245 from query where __hibernate_row_nr__ >= ? and __hibernate_row_nr__ < ?",
|
" select f53245 from query where __hibernate_row_nr__ >= ? and __hibernate_row_nr__ < ?",
|
||||||
dialect.buildLimitHandler( input, toRowSelection( 10, 15 ) ).getProcessedSql().toLowerCase()
|
dialect.buildLimitHandler( input, toRowSelection( 10, 15 ) ).getProcessedSql().toLowerCase(Locale.ROOT)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -142,7 +143,7 @@ public class BasicOperationsTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
private String generateFinalNamePattern(DatabaseMetaData meta, String name) throws SQLException {
|
private String generateFinalNamePattern(DatabaseMetaData meta, String name) throws SQLException {
|
||||||
if ( meta.storesLowerCaseIdentifiers() ) {
|
if ( meta.storesLowerCaseIdentifiers() ) {
|
||||||
return name.toLowerCase();
|
return name.toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return name;
|
return name;
|
||||||
|
|
|
@ -35,6 +35,7 @@ import java.util.Currency;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.AnnotationException;
|
import org.hibernate.AnnotationException;
|
||||||
|
@ -525,8 +526,8 @@ public class BasicHibernateAnnotationsTest extends BaseCoreFunctionalTestCase {
|
||||||
s = openSession();
|
s = openSession();
|
||||||
tx = s.beginTransaction();
|
tx = s.beginTransaction();
|
||||||
Forest f2 = (Forest) s.get( Forest.class, f.getId() );
|
Forest f2 = (Forest) s.get( Forest.class, f.getId() );
|
||||||
assertEquals( f.getSmallText().toLowerCase(), f2.getSmallText() );
|
assertEquals( f.getSmallText().toLowerCase(Locale.ROOT), f2.getSmallText() );
|
||||||
assertEquals( f.getBigText().toUpperCase(), f2.getBigText() );
|
assertEquals( f.getBigText().toUpperCase(Locale.ROOT), f2.getBigText() );
|
||||||
tx.commit();
|
tx.commit();
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
@ -41,10 +42,10 @@ public class CasterStringType implements UserType, ParameterizedType {
|
||||||
String result = rs.getString( names[0] );
|
String result = rs.getString( names[0] );
|
||||||
if ( rs.wasNull() ) return null;
|
if ( rs.wasNull() ) return null;
|
||||||
if ( parameters.getProperty( CAST ).equals( "lower" ) ) {
|
if ( parameters.getProperty( CAST ).equals( "lower" ) ) {
|
||||||
return result.toLowerCase();
|
return result.toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return result.toUpperCase();
|
return result.toUpperCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,10 +56,10 @@ public class CasterStringType implements UserType, ParameterizedType {
|
||||||
else {
|
else {
|
||||||
String string = (String) value;
|
String string = (String) value;
|
||||||
if ( parameters.getProperty( CAST ).equals( "lower" ) ) {
|
if ( parameters.getProperty( CAST ).equals( "lower" ) ) {
|
||||||
string = string.toLowerCase();
|
string = string.toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
string = string.toUpperCase();
|
string = string.toUpperCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
st.setString( index, string );
|
st.setString( index, string );
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.test.annotations.join;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -216,7 +217,7 @@ public class JoinTest extends BaseCoreFunctionalTestCase {
|
||||||
s.clear();
|
s.clear();
|
||||||
|
|
||||||
Cat c = (Cat) s.get( Cat.class, cat.getId() );
|
Cat c = (Cat) s.get( Cat.class, cat.getId() );
|
||||||
assertEquals( storyPart2.toUpperCase(), c.getStoryPart2() );
|
assertEquals( storyPart2.toUpperCase(Locale.ROOT), c.getStoryPart2() );
|
||||||
|
|
||||||
tx.rollback();
|
tx.rollback();
|
||||||
s.close();
|
s.close();
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
package org.hibernate.test.annotations.namingstrategy;
|
package org.hibernate.test.annotations.namingstrategy;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -397,7 +398,7 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
|
||||||
chaos.setId( 1l );
|
chaos.setId( 1l );
|
||||||
|
|
||||||
String lowerName = "hello";
|
String lowerName = "hello";
|
||||||
String upperName = lowerName.toUpperCase();
|
String upperName = lowerName.toUpperCase(Locale.ROOT);
|
||||||
assertFalse( lowerName.equals( upperName ) );
|
assertFalse( lowerName.equals( upperName ) );
|
||||||
|
|
||||||
chaos.setName( "hello" );
|
chaos.setName( "hello" );
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.test.interceptor;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -296,8 +297,8 @@ public class InterceptorTest extends BaseCoreFunctionalTestCase {
|
||||||
@Override
|
@Override
|
||||||
public String onPrepareStatement(String sql) {
|
public String onPrepareStatement(String sql) {
|
||||||
assertNotNull( sql );
|
assertNotNull( sql );
|
||||||
String expectedSql = expectedSQLs.poll().toLowerCase();
|
String expectedSql = expectedSQLs.poll().toLowerCase(Locale.ROOT);
|
||||||
assertTrue("sql:\n " + sql.toLowerCase() +"\n doesn't start with \n"+expectedSql+"\n", sql.toLowerCase().startsWith( expectedSql ) );
|
assertTrue("sql:\n " + sql.toLowerCase(Locale.ROOT) +"\n doesn't start with \n"+expectedSql+"\n", sql.toLowerCase(Locale.ROOT).startsWith( expectedSql ) );
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//$Id: Document.java 7772 2005-08-05 23:03:46Z oneovthafew $
|
//$Id: Document.java 7772 2005-08-05 23:03:46Z oneovthafew $
|
||||||
package org.hibernate.test.lazycache;
|
package org.hibernate.test.lazycache;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
|
@ -17,7 +18,7 @@ public class Document {
|
||||||
public Document(String name, String summary, String text) {
|
public Document(String name, String summary, String text) {
|
||||||
lastTextModification = new Date();
|
lastTextModification = new Date();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
upperCaseName = name.toUpperCase();
|
upperCaseName = name.toUpperCase(Locale.ROOT);
|
||||||
this.summary = summary;
|
this.summary = summary;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1950,7 +1950,7 @@ public class FooBarTest extends LegacyTestCase {
|
||||||
List list = s.createCriteria(Foo.class)
|
List list = s.createCriteria(Foo.class)
|
||||||
.add( Restrictions.eq( "integer", f.getInteger() ) )
|
.add( Restrictions.eq( "integer", f.getInteger() ) )
|
||||||
.add( Restrictions.eqProperty("integer", "integer") )
|
.add( Restrictions.eqProperty("integer", "integer") )
|
||||||
.add( Restrictions.like( "string", f.getString().toUpperCase() ).ignoreCase() )
|
.add( Restrictions.like( "string", f.getString().toUpperCase(Locale.ROOT) ).ignoreCase() )
|
||||||
.add( Restrictions.in( "boolean", new Boolean[] { f.getBoolean(), f.getBoolean() } ) )
|
.add( Restrictions.in( "boolean", new Boolean[] { f.getBoolean(), f.getBoolean() } ) )
|
||||||
.setFetchMode("foo", FetchMode.JOIN)
|
.setFetchMode("foo", FetchMode.JOIN)
|
||||||
.setFetchMode("baz", FetchMode.SELECT)
|
.setFetchMode("baz", FetchMode.SELECT)
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package org.hibernate.test.legacy;
|
package org.hibernate.test.legacy;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class StringComparator implements Comparator, Serializable {
|
public class StringComparator implements Comparator, Serializable {
|
||||||
|
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(Object o1, Object o2) {
|
||||||
return ( (String) o1 ).toLowerCase().compareTo( ( (String) o2 ).toLowerCase() );
|
return ( (String) o1 ).toLowerCase(Locale.ROOT).compareTo( ( (String) o2 ).toLowerCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.test.manytomany.batchload;
|
package org.hibernate.test.manytomany.batchload;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.EmptyInterceptor;
|
import org.hibernate.EmptyInterceptor;
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
|
@ -97,7 +98,7 @@ public class BatchedManyToManyTest extends BaseCoreFunctionalTestCase {
|
||||||
// of dialects...
|
// of dialects...
|
||||||
Assert.assertFalse(
|
Assert.assertFalse(
|
||||||
"batch load of many-to-many should use inner join",
|
"batch load of many-to-many should use inner join",
|
||||||
sql.toLowerCase().contains( "left outer join" )
|
sql.toLowerCase(Locale.ROOT).contains( "left outer join" )
|
||||||
);
|
);
|
||||||
return super.onPrepareStatement( sql );
|
return super.onPrepareStatement( sql );
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.math.BigInteger;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
|
@ -902,7 +903,7 @@ public class NativeSQLQueriesTest extends BaseCoreFunctionalTestCase {
|
||||||
for ( int i = 0; i < tuple.length; i++ ) {
|
for ( int i = 0; i < tuple.length; i++ ) {
|
||||||
String alias = aliases[i];
|
String alias = aliases[i];
|
||||||
if ( alias != null ) {
|
if ( alias != null ) {
|
||||||
result.put( alias.toUpperCase(), tuple[i] );
|
result.put( alias.toUpperCase(Locale.ROOT), tuple[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.test.stateless.fetching;
|
package org.hibernate.test.stateless.fetching;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -95,7 +96,7 @@ public class StatelessSessionFetchingTest extends BaseCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String determineUniquePrefix() {
|
private String determineUniquePrefix() {
|
||||||
return StringHelper.collapseQualifier( getClass().getName(), false ).toUpperCase();
|
return StringHelper.collapseQualifier( getClass().getName(), false ).toUpperCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.jpa.criteria.expression.function;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import javax.persistence.criteria.Expression;
|
import javax.persistence.criteria.Expression;
|
||||||
|
|
||||||
import org.hibernate.jpa.criteria.CriteriaBuilderImpl;
|
import org.hibernate.jpa.criteria.CriteriaBuilderImpl;
|
||||||
|
@ -73,7 +74,7 @@ public class ParameterizedFunctionExpression<X>
|
||||||
List<Expression<?>> argumentExpressions) {
|
List<Expression<?>> argumentExpressions) {
|
||||||
super( criteriaBuilder, javaType, functionName );
|
super( criteriaBuilder, javaType, functionName );
|
||||||
this.argumentExpressions = argumentExpressions;
|
this.argumentExpressions = argumentExpressions;
|
||||||
this.isStandardJpaFunction = STANDARD_JPA_FUNCTION_NAMES.contains( functionName.toUpperCase() );
|
this.isStandardJpaFunction = STANDARD_JPA_FUNCTION_NAMES.contains( functionName.toUpperCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParameterizedFunctionExpression(
|
public ParameterizedFunctionExpression(
|
||||||
|
@ -83,7 +84,7 @@ public class ParameterizedFunctionExpression<X>
|
||||||
Expression<?>... argumentExpressions) {
|
Expression<?>... argumentExpressions) {
|
||||||
super( criteriaBuilder, javaType, functionName );
|
super( criteriaBuilder, javaType, functionName );
|
||||||
this.argumentExpressions = Arrays.asList( argumentExpressions );
|
this.argumentExpressions = Arrays.asList( argumentExpressions );
|
||||||
this.isStandardJpaFunction = STANDARD_JPA_FUNCTION_NAMES.contains( functionName.toUpperCase() );
|
this.isStandardJpaFunction = STANDARD_JPA_FUNCTION_NAMES.contains( functionName.toUpperCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isStandardJpaFunction() {
|
protected boolean isStandardJpaFunction() {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.jpa.internal.util;
|
package org.hibernate.jpa.internal.util;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import javax.persistence.FlushModeType;
|
import javax.persistence.FlushModeType;
|
||||||
|
@ -65,7 +66,7 @@ public abstract class ConfigurationHelper {
|
||||||
if (flushMode == null) {
|
if (flushMode == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
flushMode = flushMode.toUpperCase();
|
flushMode = flushMode.toUpperCase(Locale.ROOT);
|
||||||
return FlushMode.valueOf( flushMode );
|
return FlushMode.valueOf( flushMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ package org.hibernate.jpa.internal.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
@ -192,7 +193,7 @@ public final class XmlHelper {
|
||||||
public static boolean getOptionalChildBooleanContent(Element element, String name) throws Exception {
|
public static boolean getOptionalChildBooleanContent(Element element, String name) throws Exception {
|
||||||
Element child = getOptionalChild( element, name );
|
Element child = getOptionalChild( element, name );
|
||||||
if ( child != null ) {
|
if ( child != null ) {
|
||||||
String value = getElementContent( child ).toLowerCase();
|
String value = getElementContent( child ).toLowerCase(Locale.ROOT);
|
||||||
return value.equals( "true" ) || value.equals( "yes" );
|
return value.equals( "true" ) || value.equals( "yes" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.jpa.test.metadata;
|
package org.hibernate.jpa.test.metadata;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.persistence.metamodel.Attribute;
|
import javax.persistence.metamodel.Attribute;
|
||||||
|
@ -408,7 +409,7 @@ public class MetadataTest extends BaseEntityManagerFunctionalTestCase {
|
||||||
for (Attribute<?,?> attribute : safeAttributes ) {
|
for (Attribute<?,?> attribute : safeAttributes ) {
|
||||||
final String name = attribute.getJavaMember().getName();
|
final String name = attribute.getJavaMember().getName();
|
||||||
assertNotNull( attribute.getJavaMember() );
|
assertNotNull( attribute.getJavaMember() );
|
||||||
assertTrue( name.toLowerCase().endsWith( attribute.getName().toLowerCase() ) );
|
assertTrue( name.toLowerCase(Locale.ROOT).endsWith( attribute.getName().toLowerCase(Locale.ROOT) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ import org.hibernate.envers.internal.tools.query.QueryBuilder;
|
||||||
import org.hibernate.envers.query.criteria.AuditCriterion;
|
import org.hibernate.envers.query.criteria.AuditCriterion;
|
||||||
import org.hibernate.envers.query.internal.property.PropertyNameGetter;
|
import org.hibernate.envers.query.internal.property.PropertyNameGetter;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class IlikeAuditExpression implements AuditCriterion {
|
public class IlikeAuditExpression implements AuditCriterion {
|
||||||
|
|
||||||
private PropertyNameGetter propertyNameGetter;
|
private PropertyNameGetter propertyNameGetter;
|
||||||
|
@ -28,7 +30,7 @@ public class IlikeAuditExpression implements AuditCriterion {
|
||||||
propertyNameGetter);
|
propertyNameGetter);
|
||||||
CriteriaTools.checkPropertyNotARelation( auditCfg, entityName, propertyName );
|
CriteriaTools.checkPropertyNotARelation( auditCfg, entityName, propertyName );
|
||||||
|
|
||||||
parameters.addWhereWithFunction( propertyName, " lower ", " like ", value.toLowerCase() );
|
parameters.addWhereWithFunction( propertyName, " lower ", " like ", value.toLowerCase(Locale.ROOT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.jpamodelgen.util;
|
package org.hibernate.jpamodelgen.util;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
|
@ -104,7 +106,7 @@ public final class StringUtil {
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return string.substring( 0, 1 ).toLowerCase() + string.substring( 1 );
|
return string.substring( 0, 1 ).toLowerCase(Locale.ROOT) + string.substring( 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue