HHH-10693 - Fix PostgreSQL should not use nvarchar when using Nationaliztaion
This commit is contained in:
parent
c1023ac49e
commit
513c2358f7
|
@ -39,6 +39,8 @@ import org.hibernate.cfg.Ejb3JoinColumn;
|
|||
import org.hibernate.cfg.NotYetImplementedException;
|
||||
import org.hibernate.cfg.PkDrivenByDefaultMapsIdSecondPass;
|
||||
import org.hibernate.cfg.SetSimpleValueTypeSecondPass;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.mapping.SimpleValue;
|
||||
|
@ -150,8 +152,10 @@ public class SimpleValueBinder {
|
|||
typeParameters.clear();
|
||||
String type = BinderHelper.ANNOTATION_STRING_DEFAULT;
|
||||
|
||||
if ( getDialect().supportsNationalizedTypes() ) {
|
||||
isNationalized = property.isAnnotationPresent( Nationalized.class )
|
||||
|| buildingContext.getBuildingOptions().useNationalizedCharacterData();
|
||||
}
|
||||
|
||||
Type annType = null;
|
||||
if ( (!key && property.isAnnotationPresent( Type.class ))
|
||||
|
@ -307,6 +311,14 @@ public class SimpleValueBinder {
|
|||
applyAttributeConverter( property, attributeConverterDescriptor );
|
||||
}
|
||||
|
||||
private Dialect getDialect() {
|
||||
return buildingContext.getBuildingOptions()
|
||||
.getServiceRegistry()
|
||||
.getService( JdbcServices.class )
|
||||
.getJdbcEnvironment()
|
||||
.getDialect();
|
||||
}
|
||||
|
||||
private void applyAttributeConverter(XProperty property, AttributeConverterDescriptor attributeConverterDescriptor) {
|
||||
if ( attributeConverterDescriptor == null ) {
|
||||
return;
|
||||
|
|
|
@ -2850,4 +2850,13 @@ public abstract class Dialect implements ConversionContext {
|
|||
public boolean supportsNamedParameters(DatabaseMetaData databaseMetaData) throws SQLException {
|
||||
return databaseMetaData != null && databaseMetaData.supportsNamedParameters();
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this dialect supports Nationalized Types
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean supportsNationalizedTypes() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -599,4 +599,9 @@ public class PostgreSQL81Dialect extends Dialect {
|
|||
public IdentityColumnSupport getIdentityColumnSupport() {
|
||||
return new PostgreSQL81IdentityColumnSupport();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsNationalizedTypes() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue