表不存在

时间:2015-11-26 08:26:47

标签: java mysql hibernate jdbc

Iam getting,JDBCExceptionReporter org.apache.catalina.core.StandardWrapperValve invoke

嵌套异常是

  

org.hibernate.exception.SQLGrammarException:无法执行查询]   有根本原因   com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException表   不存在

的pom.xml:

!-- Hibernate framework dependencies -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>3.6.7.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.3.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.3.1.GA</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-commons-annotations</artifactId>
            <version>3.0.0.ga</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.3.2.GA</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-search</artifactId>
            <version>5.5.0.Final</version>
        </dependency>
Dta resources:
# My SQL DB Properties
database.driver=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost:3306/chospldb
database.user=xxxx
database.password=xxx
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=false
hibernate.hbm2ddl.auto=update
# MS SQl DB Properties
database2.driver=com.mysql.jdbc.Driver
database2.url=jdbc:mysql://localhost:3306/ramcodb
database2.user=root
database2.password=root
hibernate2.dialect=org.hibernate.dialect.MySQLDialect
hibernate2.show_sql=false
hibernate2.hbm2ddl.auto=create
# SMTP Mail Settings
mail.host=smtp.gmail.com
mail.port=587
mail.username=xxxx.xx@gmail.com
mail.password=xxxxx
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.from=xxxx.xxx@gmail.com
mail.to=cdcdc.manchala@gmail.com
mail.subject=Finance Statement Report From CallHealth
Spring_context.xml:
<?xml  version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:lang="http://www.springframework.org/schema/lang"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
        http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd 
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
    <context:property-placeholder location="classpath:resources/database.properties,classpath:resources/config.properties" />
    <!-- <context:property-placeholder location="resources/database.properties" /> -->
    <context:component-scan base-package="com.callhealth.erp.web" />
    <!-- <mvc:resources location="/images/" mapping="/images/**"/> -->
    <!-- <mvc:annotation-driven/> -->
    <tx:annotation-driven transaction-manager="hibernateTransactionManager"/>
    <!-- <task:annotation-driven/> -->
    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="basename" value="classpath:resources/messages" />
        <property name="defaultEncoding" value="UTF-8" />
    </bean>

    <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="order" value="2"/>
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/views/" />
        <property name="suffix" value=".jsp" />
    </bean>

     <bean id="viewResolver1" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
        <property name="order" value="1"/>
        <property name="basename" value="resources/views"/>
    </bean>
    <bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
       <property name="resourceLoaderPath" value="/WEB-INF/velocity/"/>
    </bean> 
    <!-- <bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
      <property name="resourceLoaderPath" value="/WEB-INF/velocity/"/>
    </bean>

    <bean id="viewResolver0" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
      <property name="cache" value="true"/>
      <property name="prefix" value=""/>
      <property name="suffix" value=".vm"/>
      <property name="order" value="0" />
    </bean> -->

    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> 
         <!-- setting maximum upload size -->
        <property name="maxUploadSize" value="1000000" /> 
    </bean>

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/chospldb" />
        <property name="username" value="root" />
        <property name="password" value="root" />
    </bean>

    <bean id="dataSourceMS" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/ramcodb" />
        <property name="username" value="root" />
        <property name="password" value="root" />
    </bean>

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="annotatedClasses">
            <list>
                <value>com.callhealth.erp.web.model.Orders</value>
                <value>com.callhealth.erp.web.model.Payments</value>
                <value>com.callhealth.erp.web.model.Shipments</value>
                <value>com.callhealth.erp.web.model.Transactions</value>
                <value>com.callhealth.erp.web.model.OrderDetails</value>
                <value>com.callhealth.erp.web.model.Products</value>
                <value>com.callhealth.erp.web.model.Vendors</value>
                <value>com.callhealth.erp.web.model.PGBank</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>             
            </props>
        </property>
    </bean>

    <bean id="sessionFactoryMS" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSourceMS" />
        <property name="annotatedClasses">
            <list>
                <value>com.callhealth.erp.web.model.CustomerBilling</value>
                <value>com.callhealth.erp.web.model.CustomerReceipt</value>
                <value>com.callhealth.erp.web.model.DebitNote</value>
                <value>com.callhealth.erp.web.model.CreditNote</value>
                <value>com.callhealth.erp.web.model.SundryPayment</value>
                <value>com.callhealth.erp.web.model.SundryReceipt</value>
                <value>com.callhealth.erp.web.model.TaxMST</value>
                <value>com.callhealth.erp.web.model.CustomerDetails</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernatems.dialect">${hibernate.dialect}</prop>
                <prop key="hibernatems.show_sql">true</prop>
                <prop key="hibernatems.hbm2ddl.auto">create</prop>              
            </props>
        </property>
    </bean>

    <bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <bean id="hibernateTransactionManagerMS" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactoryMS" />
    </bean>

    <!-- SET default mail properties -->
    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
        <property name="host" value="${mail.host}" />
        <property name="port" value="${mail.port}" />
        <property name="username" value="${mail.username}" />
        <property name="password" value="${mail.password}" />

        <property name="javaMailProperties">
            <props>`enter code here`
                <prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
                <prop key="mail.smtp.starttls.enable">${mail.smtp.starttls.enable}</prop>
            </props>
        </property>
    </bean>

    <bean id="mailMail" class="com.callhealth.erp.web.mail.MailMail">
        <property name="mailSender" ref="mailSender" />
        <property name="simpleMailMessage" ref="customeMailMessage" />
    </bean>

    <bean id="customeMailMessage" class="org.springframework.mail.SimpleMailMessage">    
        <property name="from" value="${mail.from}" />
        <property name="to" value="${mail.to}" />
        <property name="subject" value="${mail.subject}" />
        <property name="text">
            <value>
                <![CDATA[
                    Dear %s,
                    %s
                ]]>
            </value>
        </property>
    </bean>
    <bean id="demoServiceXmlConfig" class="com.callhealth.erp.web.common.DemoServiceXmlConfig" />
    <task:scheduled-tasks>
        <task:scheduled ref="demoServiceXmlConfig" method="demoServiceMethod" cron="${cron.expression}"></task:scheduled>
    </task:scheduled-tasks>
</beans>

0 个答案:

没有答案