I integrate spring with hibernate, I use the dropwizard configuration files, because: the persistence file has configuration files in the resource folder, without any problems loading xml files. There is a problem with the table found. The persistence.xml file as:
<persistence-unit name="bfm" transaction-type="RESOURCE_LOCAL" > <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>com.bcits.parkingmanagement.model.User</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/anuj" /> <property name="javax.persistence.jdbc.user" value="root" /> <property name="javax.persistence.jdbc.password" value="root" /> <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /> </persistence-unit> </persistence>
In spring app config xml as: only sleep configuration is displayed there
<context:annotation-config /> <context:component-scan base-package="com.bcits.parkingmanagement.model" /> <jdbc:embedded-database id="dataSource" type="HSQL" /> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceXmlLocation" value="classpath:spring/persistence.xml" /> <property name="dataSource" ref="dataSource"/> </bean> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <bean id="entityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean>
Missing user table
javax.persistence.PersistenceException: [PersistenceUnit: bfm] Unable to build EntityManagerFactory org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562) ... 18 more Caused by: org.hibernate.HibernateException: Missing table: user
Please help me how can I resolve this error. I want the spring configuration with hibernate.I that it connects to the database but cannot find the table. The table name and colume name are exactly the same. The database name is also correct and without problems with the username and password of the database.
source share