I am calling a stored procedure from hibernate but it is giving me an error.I executed the stored procedure in mysql separately and it gave me the result.This is the error i got from hibernate
org.springframework.orm.hibernate3.HibernateSystemException: No Dialect mapping for JDBC type: -1; nested exception is org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:676)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:988)
at com.iris.allofactor.data.dao.hibernate.HibernatePatientDao.getDetailedPatientList(HibernatePatientDao.java:2352)
at com.iris.allofactor.data.dao.test.PatientDaoTest.testgetPatientDetails(PatientDaoTest.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:192)
at org.hibernate.loader.custom.CustomLoader.getHibernateType(CustomLoader.java:161)
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:131)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1678)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
at org.springframework.orm.hibernate3.HibernateTemplate$33.doInHibernate(HibernateTemplate.java:997)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
... 22 more
This is the stored procedure i am trying to call
PROCEDURE DETAILED_PATIENT_LIST(_clinicId INT,_offset INT,_count INT)
BEGIN
SET @a = _offset;
SET @b = _count;
SET @c = _clinicId;
DROP TEMPORARY TABLE IF EXISTS MAX_VISIT;
DROP TEMPORARY TABLE IF EXISTS TOTAL_VISIT;
CREATE TEMPORARY TABLE TOTAL_VISIT (
KEY TOTAL_KEY(CLINIC_ID) )
SELECT VISIT_DATE AS VISIT_DATE,PV.PATIENT_ID,PV.VISIT_ID,PV.CLINIC_ID,VD.ICD_CODE_ONE,VD.ICD_CODE_TWO,
VD.ICD_CODE_THREE,VD.ICD_CODE_FOUR,GROUP_CONCAT(VP.PROCEDURE_CODE SEPARATOR ',') PROCEDURE_CODE FROM
PATIENT_VISIT PV
JOIN VISIT_PROCEDURE VP ON VP.CLINIC_ID = PV.CLINIC_ID AND VP.VISIT_ID = PV.VISIT_ID
JOIN VISIT_DIAGNOSIS VD ON VD.CLINIC_ID = PV.CLINIC_ID AND VD.VISIT_ID = PV.VISIT_ID
WHERE PV.CLINIC_ID = _clinicId AND VD.ICD_ID_ONE <> 0 GROUP BY PV.VISIT_ID
ORDER BY PATIENT_ID,VISIT_DATE DESC;
CREATE TEMPORARY TABLE MAX_VISIT (
KEY `MAX_KEY` (`CLINIC_ID`,`PATIENT_ID`) )
SELECT MAX(VISIT_DATE) AS VISIT_DATE,PATIENT_ID,VISIT_ID,CLINIC_ID,ICD_CODE_ONE,ICD_CODE_TWO,
ICD_CODE_THREE,ICD_CODE_FOUR,PROCEDURE_CODE FROM TOTAL_VISIT WHERE CLINIC_ID = _clinicId GROUP BY PATIENT_ID;
PREPARE STMT FROM "SELECT P.PATIENT_ID,P.CLINIC_ID,P.MRN,P.FIRST_NAME,P.LAST_NAME,P.MIDDLE_NAME,P.SSN,P.DOB,P.SEX,P.A DDRESS_LINE1,
P.ADDRESS_LINE2,P.CITY,P.STATE,P.COUNTRY,P.PHONE,P.ZIP,P.FAX,P.EMAIL,P.BILLING_METHOD,P.ALT_PHONE,
P.MARITAL_STATUS,P.ACTIVE,P.INACTIVE_REASON,
I1.POLICY_NO AS PRIMARY_POLICY_NO,I1.GROUP_NO AS PRIMARY_GROUP_NO,I1.EDOC_END AS I1EDOC_END,
I2.POLICY_NO AS SECONDERY_POLICY_NO,I2.GROUP_NO AS SECONDERY_GROUP_NO,I2.EDOC_END AS I2EDOC_END,
I3.POLICY_NO AS TERTIERY_POLICY_NO,I3.GROUP_NO AS TERTIERY_GROUP_NO,I3.EDOC_END AS I3EDOC_END,
B1.NAME AS PRIMARYINS,B1.ADDRESS_LINE1 AS PRIMARY_ADD1,B1.ADDRESS_LINE2 AS PRIMARY_ADD2,B1.CITY AS PRIMARY_CITY,B1.STATE AS PRIMARY_STATE,
B1.COUNTRY AS PRIMARY_COUNTRY,B1.PHONE AS PRIMARY_PHONE,B1.ZIP AS PRIMARY_ZIP,B1.EMAIL AS PRIMARY_EMAIL,
B2.NAME AS SECONDERY,B2.ADDRESS_LINE1 AS SECONDERY_ADD1,B2.ADDRESS_LINE2 AS SECONDERY_ADD2,B2.CITY AS SECONDERY_CITY,B2.STATE AS SECONDERY_STATE,
B2.COUNTRY AS SECONDERY_COUNTRY,B2.PHONE AS SECONDERY_PHONE,B2.ZIP AS SECONDERY_ZIP,B2.EMAIL AS SECONDERY_EMAIL,
B3.NAME AS TERTIERY,B3.ADDRESS_LINE1 AS TERTIERY_ADD1,B3.ADDRESS_LINE2 AS TERTIERY_ADD2,B3.CITY AS TERTIERY_CITY,B3.STATE AS TERTIERY_STATE,
B3.COUNTRY AS TERTIERY_COUNTRY,B3.PHONE AS TERTIERY_PHONE,B3.ZIP AS TERTIERY_ZIP,B3.EMAIL AS TERTIERY_EMAIL,
CONCAT(PH1.LAST_NAME, ', ' , PH1.FIRST_NAME , ' ' , PH1.MIDDLE_NAME) AS POLICYHOLDER1,PH1.RELATIONSHIP AS RELATIONSHIP1,
PH1.ADDRESS_LINE1 AS PH1ADDRESS_LINE1,PH1.ADDRESS_LINE2 AS PH1ADDRESS_LINE2,PH1.CITY AS PH1CITY,PH1.STATE AS PH1STATE,PH1.COUNTRY AS PH1COUNTRY,
CONCAT(PH2.LAST_NAME, ', ' , PH2.FIRST_NAME , ' ' , PH2.MIDDLE_NAME) AS POLICYHOLDER2,PH2.RELATIONSHIP AS RELATIONSHIP2,
PH2.ADDRESS_LINE1 AS PH2ADDRESS_LINE1,PH2.ADDRESS_LINE2 AS PH2ADDRESS_LINE2,PH2.CITY AS PH2CITY,PH2.STATE AS PH2STATE,PH2.COUNTRY AS PH2COUNTRY,
CONCAT(PH3.LAST_NAME, ', ' , PH3.FIRST_NAME , ' ' , PH3.MIDDLE_NAME) AS POLICYHOLDER3,PH3.RELATIONSHIP AS RELATIONSHIP3,
PH3.ADDRESS_LINE1 AS PH3ADDRESS_LINE1,PH3.ADDRESS_LINE2 AS PH3ADDRESS_LINE2,PH3.CITY AS PH3CITY,PH3.STATE AS PH3STATE,PH3.COUNTRY AS PH3COUNTRY,
VISIT_DATE AS LASTVISIT,P.NET_BALANCE,ICD_CODE_ONE,ICD_CODE_TWO,ICD_CODE_THREE,ICD_CODE_FOUR,PROCEDURE_CODE
FROM PATIENT P
LEFT JOIN A I1 ON (I1.CLINIC_ID = P.CLINIC_ID AND I1.PATIENT_ID = P.PATIENT_ID AND I1.ACTIVE = TRUE AND I1.RANKING = 1)
LEFT JOIN B I2 ON (I2.CLINIC_ID = P.CLINIC_ID AND I2.PATIENT_ID = P.PATIENT_ID AND I2.ACTIVE = TRUE AND I2.RANKING = 2)
LEFT JOIN C I3 ON (I3.CLINIC_ID = P.CLINIC_ID AND I3.PATIENT_ID = P.PATIENT_ID AND I3.ACTIVE = TRUE AND I3.RANKING = 3)
LEFT JOIN D B1 ON (B1.CLINIC_ID = I1.CLINIC_ID AND B1.BUSINESS_ID = I1.COMPANY_ID AND I1.RANKING = 1 AND B1.ACTIVE = TRUE)
LEFT JOIN D B2 ON (B2.CLINIC_ID = I2.CLINIC_ID AND B2.BUSINESS_ID = I2.COMPANY_ID AND I2.RANKING = 2 AND B2.ACTIVE = TRUE)
LEFT JOIN D B3 ON (B3.CLINIC_ID = I3.CLINIC_ID AND B3.BUSINESS_ID = I3.COMPANY_ID AND I3.RANKING = 3 AND B3.ACTIVE = TRUE)
LEFT JOIN E PH1 ON (PH1.CLINIC_ID = I1.CLINIC_ID AND PH1.POLICY_HOLDER_ID =开发者_JAVA百科 I1.POLICY_HOLDER_ID)
LEFT JOIN E PH2 ON (PH2.CLINIC_ID = I2.CLINIC_ID AND PH2.POLICY_HOLDER_ID = I2.POLICY_HOLDER_ID)
LEFT JOIN E PH3 ON (PH3.CLINIC_ID = I3.CLINIC_ID AND PH3.POLICY_HOLDER_ID = I3.POLICY_HOLDER_ID)
LEFT JOIN MAX_VISIT ON (MAX_VISIT.CLINIC_ID = P.CLINIC_ID AND MAX_VISIT.PATIENT_ID = P.PATIENT_ID)
WHERE P.CLINIC_ID = ? AND P.MARK_AS_DELETE = 0 LIMIT ?,?";
EXECUTE STMT USING @c,@a,@b;
END
I am not sure why this error occurs as i am getting the result calling the stored procedure independantly.Can anyone have a solution for this.Thanks in advance..
This is the configuration for hibernate ,code
--------------------------------------------------------------------------------------- ------
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
#hibernate.query_factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory
hibernate.query_factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.query.factory_class">${hibernate.query_factory_class}</prop>
<prop key="hibernate.generate_statistics">true</prop>
</props>
</property>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"><ref bean="sessionFactory"/></property>
</bean>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<sql-query name="getDetailedPatientListReport" callable="true" >
{ call DETAILED_PATIENT_LIST (?,?,?) }
</sql-query>
</hibernate-mapping>
code:
getHibernateTemplate().findByNamedQuery("getDetailedPatientListReport",new Object[]
{iClinicId,start,range});
精彩评论