小编use*_*566的帖子

没有 JDBC 类型的方言映射:-101

这是我的代码:

String q="select * from emp";
Query que  = em.createNativeQuery(q);
it is working fine but for 

String q="select * from dept";
Run Code Online (Sandbox Code Playgroud)

我使用了基于注释的映射。但它会导致这个异常:

Hibernate: select  activity_id,accepted_on,resource_id, updated_date from case_assignment_history
javax.persistence.PersistenceException: org.hibernate.MappingException: No Dialect mapping for JDBC type: -101
    at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:311)
    at $Proxy39.getResultList(Unknown Source)
    at com.quintiles.smsw.core.infrastructure.model.impl.AssignmentPersistent.getCaseHistory(AssignmentPersistent.java:2254)
    at com.quintiles.smsw.core.infrastructure.service.AssignmentService.GetCaseHistory(AssignmentService.java:1033)
    at com.quintiles.smsw.infrastructure.service.test.AssignmentServiceTest.testGetCaseHistory(AssignmentServiceTest.java:86)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) …
Run Code Online (Sandbox Code Playgroud)

java hibernate jdbc

2
推荐指数
1
解决办法
5730
查看次数

标签 统计

hibernate ×1

java ×1

jdbc ×1