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 8868313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:14:33+00:00 2026-06-14T17:14:33+00:00

When I try compile with Maven I get this error: INFO: HHH000041: Configured SessionFactory:

  • 0

When I try compile with Maven I get this error:

INFO: HHH000041: Configured SessionFactory: null
Error creating Session: org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/baskeitor/models/User.hbm.xml

But I don’t see where is the error:

User.java

package main.java.com.project.models;

public class User implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private Long id;

private String firstName;
private String secondName;
private String email;
private String password;
private Set<Artifact> artifact = new HashSet<Artifact>();

public User(){}

public User(String firstName, String secondName, String email, String password){
    this.firstName = firstName;
    this.secondName = secondName;
    this.email = email;
    this.password = password;
}   

public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public Set<Artifact> getArtifacts() {
    return teams;
}

public void setArtifacts(Set<Artifact> artifacts) {
    this.teams = team;
}

public String getFirstName() {
    return firstName;
}

public void setFirstName(String firstName) {
    this.firstName = firstName;
}

public String getSecondName() {
    return secondName;
}

public void setSecondName(String secondName) {
    this.secondName = secondName;
}

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}

public String getPassword() {
    return password;
}

public void setPassword(String password) {
    this.password = password;
}

}

User.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.project.models">
    <class name="User" table="USER">
        <id name="id" column="USER_ID">
            <generator class="native"/>
        </id>
        <property name="firstName"/>
        <property name="secondName"/>
        <property name="email"/>
        <property name="password"/>
    </class>
</hibernate-mapping>         

hibernate.cfg.xml

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <!-- Database connection settings -->
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost:3306/db</property>
        <property name="connection.username">user</property>
        <property name="connection.password">pass</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">1</property>
        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <!-- Enable Hibernate's automatic session context management -->
        <property name="current_session_context_class">thread</property>
        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>        
        <property name="hbm2ddl.auto">create</property>

        <mapping resource="com/project/models/User.hbm.xml"/>

    </session-factory>
</hibernate-configuration>  

I get this error when maven runs a test where I try get HibernateUtil.getSessionFactory();

  • 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-14T17:14:34+00:00Added an answer on June 14, 2026 at 5:14 pm

    It seems like there is a couple of problems here, first of all, the hibernate mapping file can not be found. What’s peculiar is that the location you are given in the maven output doesn’t match the location you have specified in your hibernate config.

    you have

    <mapping resource="com/project/models/User.hbm.xml"/>
    

    but hibernate is complaining about not being able to find com/baskeitor/models/User.hbm.xml. This value is obviously arbitrarily being made up made up by hibernate, so it must be set somewhere. Try and search around for it using whichever tool you like to search though files with.

    Also, there is a problem with the package attribute of your hibernate-mapping element, its set as com.project.models in your hbm file but the actual package is main.java.com.project.models.

    So, since the package name you specify in the hibernate-mapping element is prefixed in-front of unqualified class names in the mapping document, class name in the class element will be com.project.models.User, which doesn’t match the actual class name.

    (On a side node, why not look using the annotations? They feel so much more natural to work with imho)

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

Sidebar

Related Questions

When I try compile with maven 3.0.4, Eclipse give me this error: Failed to
When I try to compile Gforth 0.7.0, I get the following error: $ ./configure
I try to compile maven web project with <dependency> <groupId>org.springframework.ws</groupId> <artifactId>spring-ws</artifactId> <version>3.0.5-FINAL</version> </dependency> The
i have problem with maven. When i try to compile test classes ( mvn
When I try to compile my program on ubuntu using gcc, i get these
When I try to compile this code: struct BasicVertexProperties { Vect3Df position; }; struct
When I try to compile TOSSIM in tiny OS v-2.0.2 , this is the
When I try to create Maven project with this parameters: Archetype Group Id -
I try to compile code, that beggins with: #include<stdlib.h> #include<GL/gl.h> #include<glaux.h> with command: cc
I try to compile and link my application in 2 steps : Compiling: g++

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.