HHH-10183 - Mapping for NVARCHAR in SqlServer not working with native queries; org.hibernate.MappingException: No Dialect mapping for JDBC type: -9

(cherry picked from commit 0693b54256)
This commit is contained in:
Max Tian 2017-01-10 16:08:03 +08:00 committed by Gail Badner
parent e450e55bd9
commit d7604aa55d
3 changed files with 6 additions and 2 deletions

View File

@ -202,6 +202,7 @@ public abstract class Dialect implements ConversionContext {
registerHibernateType( Types.TIME, StandardBasicTypes.TIME.getName() );
registerHibernateType( Types.TIMESTAMP, StandardBasicTypes.TIMESTAMP.getName() );
registerHibernateType( Types.VARCHAR, StandardBasicTypes.STRING.getName() );
registerHibernateType( Types.NVARCHAR, StandardBasicTypes.NSTRING.getName() );
registerHibernateType( Types.VARBINARY, StandardBasicTypes.BINARY.getName() );
registerHibernateType( Types.LONGVARCHAR, StandardBasicTypes.TEXT.getName() );
registerHibernateType( Types.LONGVARBINARY, StandardBasicTypes.IMAGE.getName() );

View File

@ -142,6 +142,11 @@ public class StandardBasicTypes {
*/
public static final StringType STRING = StringType.INSTANCE;
/**
* The standard Hibernate type for mapping {@link String} to JDBC {@link java.sql.Types#NVARCHAR NVARCHAR}
*/
public static final StringNVarcharType NSTRING = StringNVarcharType.INSTANCE;
/**
* The standard Hibernate type for mapping {@link java.net.URL} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
*

View File

@ -16,7 +16,6 @@ import org.hibernate.Session;
import org.hibernate.annotations.Nationalized;
import org.hibernate.dialect.SQLServer2008Dialect;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -37,7 +36,6 @@ public class NationalizedScalarQueryTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpected(jiraKey = "HHH-10183")
public void testScalarResult() {
User user1 = new User( 1, "Chris" );