Hibernate:收到错误“嵌套异常是org.hibernate.MappingException:JDBC类型的方言映射没有:-15”

问题描述 投票:0回答:1

我在使用本机查询时遇到异常,嵌套异常是org.hibernate.MappingException:JDBC类型的方言映射没有:-15

我的代码是

String sqlQuery = "select emp_id, name, address, dept from employee  where dept in ( Select dept  from department  where status=:status)";
Map<String, Object> queryParams = new HashMap<>();
queryParams.put("status", "Active");
Query sqlQuery = entityManager.createNativeQuery(query.toString());
queryParams.forEach(sqlQuery::setParameter);
List queryResults = (List) sqlQuery.getResultList(); // This line is throwing exception

我正在使用的数据库是:SQLServer2012。数据库配置是:

spring.datasource.username=testUser
spring.datasource.password=******
spring.datasource.url=jdbc:sqlserver://server:port;databaseName=testDB;
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.hikari.maximum-pool-size=75
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.minimum-idle=10

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.id.new_generator_mappings=false
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.generate_statistics=false
spring.jpa.properties.hibernate.default_batch_fetch_size=100
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

java hibernate spring-data-jpa spring-data
1个回答
0
投票
String sqlQuery = "select emp_id as emp_id , name as name , address address, dept as dept from employee where dept in ( Select dept as dept_department from department where status=:status)";
热门问题
推荐问题
最新问题