我已经尝试了很多方法来调用一个简单的存储过程 com hibernate 并且不能只是找到一种方法。
我有一个返回本地表变量的过程:
SET NOCOUNT ON
declare @tableTemp Table
(
ID int,
Tipo nvarchar(50),
Regra nvarchar(50),
Quantidade int
)
select * from @tableTemp
我的查询是:
Query query = em.createNativeQuery("{call GetEstatisticasDeRegras}");
List result = query.getResultList();
我不断收到错误:
javax.persistence.PersistenceException: org.hibernate.MappingException: **No Dialect mapping for JDBC type: -9**
已经尝试过:
*调用GetEstatisticasDeRegras
*exec GetEstatisticasDeRegras
*执行GetEstatisticasDeRegras
*{调用GetEstatisticasDeRegras}
*exec dbo.GetEstatisticasDeRegras
但不是办法。我的用户拥有该过程的所有特权。
编辑
我的persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="SIPAAM_WS_2">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>Model.DadosPreProcessamento.Evento</class>
<class>Model.DadosPreProcessamento.Servico</class>
<class>Model.DadosPreProcessamento.DadosPreProcessamento</class>
<class>Model.Jobs.Job</class>
<class>Model.Jobs.JobFiltro</class>
<class>Model.Jobs.JobResultado</class>
<class>Model.Jobs.JobResultadoDados</class>
<class>Model.Jobs.JobResultadoPontuacao</class>
<class>Model.Jobs.JobEstatisticas</class>
<class>Model.Usuario.Usuario</class>
<properties>
<property name="hibernate.connection.url"
value="jdbc:sqlserver://localhost;databaseName=SIPAAM;" />
<property name="hibernate.connection.username" value="x" />
<property name="hibernate.connection.password" value="x" />
<property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
有什么帮助吗?