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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:35:36+00:00 2026-06-15T12:35:36+00:00

I use Spring + Hibernate with annotations and i got the following error :

  • 0

I use Spring + Hibernate with annotations and i got the following error :

org.hibernate.hql.ast.QuerySyntaxException: Produit is not mapped [from Produit]

it appens when i call this function :

public List<Produit> getListeProduit() {

    return sessionFactory.getCurrentSession().createQuery("from Produit").list();
}

This is my hibernate.cfg.xml

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
    <mapping class="port.domain.Produit" />
</session-factory>     
</hibernate-configuration>

Produit class are annoted well with @Entity, @Table
ID with @Id, @Column, @GeneratedValue
The others columns with @Column

Here is my bean SessionFactory in my XXX-servlet.xml :

<bean id="sessionFactory"     class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation">
            <value>classpath:hibernate.cfg.xml</value>
        </property>
        <property name="configurationClass">
            <value>org.hibernate.cfg.AnnotationConfiguration</value>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
</bean>

EDIT : Entity Code

@Entity
@Table(name="produit")
public class Produit implements Serializable{

@Id
@Column(name="produit_id")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int produitId;

@Column(name="produit_nom")
private String produitNom;

public void setProduitId(int i) {
    produitId = i;
} 

public int getProduitId() {
    return produitId;
} 

public void setProduitNom(String s) {
    produitNom = s;
} 

public String getProduitNom() {
    return produitNom;
} 
}

I know there are many threads about this problem but i don’t find any correct issues.
I understand that Hibernate can’t mapped my class but i don’t know why …

Where could the problem come from ?

Thanks a lot.

  • 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-15T12:35:37+00:00Added an answer on June 15, 2026 at 12:35 pm

    Usually the problem is trivial: you should use javax.persistence.Entity instead of Hibernate-specific org.hibernate.annotations.Entity. The latter was deprecated in Hibernate in favour of JPA annotations where possible.

    That’s exactly what you didn’t show, so hope it’s a lucky shot 🙂

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

Sidebar

Related Questions

I'm trying to use Hibernate in my Spring application but i've got an error
We've got a Spring based web application that makes use of Hibernate to load/store
We have a Hibernate/Spring application that have the following Spring beans: <bean id=transactionManager class=org.springframework.orm.hibernate3.HibernateTransactionManager
in my attempt to learn a bit faster the use of spring and hibernate
In Spring MVC Hibernate application , when i am trying to use properties file
I work on Spring MVC + Hibernate application, use MySQL (ver. 5.0.51a) with the
I want to create a web app that will use wicket, hibernate and spring
In our Spring application we use clustered Hibernate Search with ActiveMQ which sets up
I'm trying to use resteasy to serve out some entities fetched by spring-hibernate. I've
I am having trouble getting the right hibernate annotations to use on a Map

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.