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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:25:39+00:00 2026-05-23T19:25:39+00:00

I get tired of this for a long time. I do not know what

  • 0

I get tired of this for a long time. I do not know what caused this error. Here are my files:

Uzytkownik.hbm.xml

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
 <class name="Uzytkownik" table="uzytkownicy">
  <id column="id" name="id" type="int"/>
  <property column="login" generated="never" lazy="false" name="login" type="string"/>
  <property column="haslo" generated="never" lazy="false" name="haslo" type="string"/>
 </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://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory name="">
  <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
  <property name="hibernate.connection.password">root</property>
  <property name="hibernate.connection.url">jdbc:mysql://localhost/sprawozdania</property>
  <property name="hibernate.connection.username">root</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
  <mapping resource="com/vaannila/uzytkownik/Uzytkownik.hbm.xml"/>
 </session-factory>
</hibernate-configuration>

I use mysql 5.5.

I get the following error:

 Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.vaannila.util.HibernateUtil.<clinit>(HibernateUtil.java:14)
    at com.vaannila.uzytkownik.Main.saveUzyt(Main.java:22)
    at com.vaannila.uzytkownik.Main.main(Main.java:16)
Caused by: org.hibernate.MappingException: entity class not found: Uzytkownik

This are my classes:
main.java

package com.vaannila.uzytkownik;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;

import javax.persistence.Entity;
import com.vaannila.util.HibernateUtil;
public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Main obj = new Main();
        String uzytkownikLogin = obj.saveUzyt("Adam", "Malysz");

    }


    public String saveUzyt(String login, String haslo){
        Session session = HibernateUtil.getSessionFactory().openSession();
        Transaction transaction = null;
        String uzytLog = null;
        try {
            transaction = session.beginTransaction();
            Uzytkownik uzyt = new Uzytkownik();
            uzyt.setLogin(login);
            uzyt.setHaslo(haslo);
            uzytLog = (String) session.save(uzyt);
            transaction.commit();
        } catch (HibernateException e) {
            transaction.rollback();
            e.printStackTrace();
        } finally {
            session.close();
        }
        return uzytLog;
    }



}

Uzytkownik.java:

package com.vaannila.uzytkownik;
// default package
// Generated 2011-07-14 13:39:18 by Hibernate Tools 3.4.0.CR1

/**
 * Uzytkownik generated by hbm2java
 */
public class Uzytkownik implements java.io.Serializable {

    private int id;
    private String login;
    private String haslo;

    public Uzytkownik() {
    }

    public Uzytkownik(int id) {
        this.id = id;
    }

    public Uzytkownik(int id, String login, String haslo) {
        this.id = id;
        this.login = login;
        this.haslo = haslo;
    }

    public int getId() {
        return this.id;
    }

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

    public String getLogin() {
        return this.login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getHaslo() {
        return this.haslo;
    }

    public void setHaslo(String haslo) {
        this.haslo = haslo;
    }

}

HibernateUtil.java:

package com.vaannila.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;


    public class HibernateUtil {
        private static final SessionFactory sessionFactory;
        static {
            try {
                sessionFactory = new Configuration().configure().buildSessionFactory();
            } catch (Throwable ex) {
                System.err.println("Initial SessionFactory creation failed." + ex);
                throw new ExceptionInInitializerError(ex);

            }

        }
        public static SessionFactory getSessionFactory() {
            return sessionFactory;
        }

}
  • 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-05-23T19:25:39+00:00Added an answer on May 23, 2026 at 7:25 pm

    Maybe your mapping file is not complete but other wise it should be:

    <class name="com.vaannila.uzytkownik.Uzytkownik" table="uzytkownicy">
    

    => need to set fully qualified class name (with package)

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

Sidebar

Related Questions

For a long time I tried desperately to get this to work, I've googled,
I tried this, but could not get through:- code behind protected HtmlTableRow trComment; protected
I tried decoding this base64 string so many times but every time i get
i tried to search this but was not able to get any proper help.I
I know this might be a long shot, but I am hoping that this
I am for a long time trying to get a picture how is program
I've tried this: richTextBoxResults.Text = listStrSessionIdLines.ToString(); ...but get the List's ToString() representation (I guess
I need to get(retrieve) updated cell value in controller. (MVC) So I tried this,
I tried using this: mvn dependency:get -DrepoUrl=http://myserver/artifactory -Dartifact=com.mypackage:my-package-name:1.0.0 However it just downloaded the pom.xml
I need query to get data between two days.I tried with this.But it gives

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.