Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8210261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:00:57+00:00 2026-06-07T10:00:57+00:00

I have Spring MVC project. I am using HSQL database and Hibernate. I have

  • 0

I have Spring MVC project. I am using HSQL database and Hibernate. I have got stuck during making connection with Spring MVC (JPA as default) and Hibernate.
I have created persistance.xml file in Spring MVC directory: src/main/resources/META-INF. I have also tried to place it in Spring MVC directory: Deployed Resources/webapp/WEB-INF/classes/META-INF. I don’t know which one is correct. I have still the same problem.

This is my persistance.xml :

<?xml version="1.0" encoding="UTF-8" ?>
<persistence 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" version="2.0"> 
<persistence-unit name="entityManager">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>package.pl.models.Users</class>
    <properties>                    
        <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
        <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:file:/home/user/hsqldb/lib/my.spring.mvc/mybase" />
        <property name="javax.persistence.jdbc.user" value="user" />
        <property name="javax.persistence.jdbc.password" value="password" />

        <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />          
        <property name="hibernate.hbm2ddl.auto" value="create" />
        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
    </properties>
</persistence-unit>

This is one of my Spring MVC controller method body:

UsersHome usersHome = new UsersHome();
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("entityManager");
EntityManager entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
usersHome.setEntityManager(entityManager);
Users user = usersHome.findByUsername(login);

I have received error on the line when I have used EntityManagerFactory for the first time – indicating the name of my Persistence Unit.

My exception is:

org.springframework.web.util.NestedServletException: Request processing failed; 
nested exception is javax.persistence.PersistenceException: No Persistence 
provider for EntityManager named entityManager

And the root cause is:

javax.persistence.PersistenceException: No Persistence provider for EntityManager named entityManager

I have used appropriate name in EntityManagerFactory. Presumably I have done mistake in my Dispatcher Servlet Context file. I have this code according to Hibernate etc.:

<!-- Hibernate session factory -->      
<beans:bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">     

    <beans:property name="dataSource">
        <beans:ref bean="dataSource" />
    </beans:property>

    <beans:property name="hibernateProperties">
        <beans:props>
            <beans:prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</beans:prop>
            <beans:prop key="hibernate.show_sql">true</beans:prop>
            <beans:prop key="hibernate.hbm2ddl.auto">update</beans:prop>
        </beans:props>
    </beans:property>

    <beans:property name="annotatedClasses">
        <beans:list>
            <beans:value>package.pl.models.Users</beans:value>                              
        </beans:list>
    </beans:property>       
</beans:bean>
<!-- Hibernate session factory end -->

<!-- <beans:bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
    <beans:property name="persistenceUnitName" value="entityManager" />
</beans:bean> -->

<beans:bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <beans:property name="sessionFactory" ref="sessionFactory" />
</beans:bean>   

<!-- <beans:bean id="usersDao" class="hutter.pl.dao.UsersHome">
    <beans:property name="entityManagerFactory" ref="entityManagerFactory" />
</beans:bean> -->

I have commented the bean id="entityManagerFactory" and bean id="usersDao". Are the necessary? However I can’t start my web application with uncommented bean id="entityManagerFactory". I am receiving this exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean with 
name 'entityManagerFactory' defined in ServletContext resource 
[/WEB-INF/spring/appServlet/servlet-context.xml]: Invocation of init method failed;
nested exception is javax.persistence.PersistenceException: No Persistence 
provider for EntityManager named entityManager
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:00:59+00:00Added an answer on June 7, 2026 at 10:00 am

    Sorry, I have not read your full question. I stopped when I saw this: persistance.xml. What about using persistence.xml?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a project using Spring MVC and JPA but I have
I have some web-project (Spring MVC + Hibernate). For hibernate objects I am using
i have been using the spring mvc frameworks lately for a university project. Could
On my current project we're using Spring 3 MVC and have a requirement to
While working on a Spring 3 MVC project using Hibernate, we encountered an annoying
I have a problem using Eclipse STS suite for developing Spring MVC project with
I am using Hibernate with my Spring MVC project. Lets say my model has
I've just setup my first Spring MVC 3 project with Hibernate 3 using Maven.
I have Roo-generated Spring MVC application connected to PostgreSQL using Hibernate. I am trying
Setup: I am using Spring-MVC in one of my project. I have to access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.