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

  • Home
  • SEARCH
  • 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 8750781
In Process

The Archive Base Latest Questions

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

I am trying to use hibernate with annotations. I annotated my class with @Entity

  • 0

I am trying to use hibernate with annotations. I annotated my class with @Entity (Made sure that this is javax.persistance.Entity instead of Hibernate’s entity) and @Table.

When I am trying to query the table with

session.createQuery("from HibernateMatchedInvoiceItem").list()

But this is failing with following exception

caused by: org.hibernate.hql.ast.QuerySyntaxException: HibernateMatchedInvoiceItem is not mapped [from HibernateMatchedInvoiceItem]

my session factory is defined as follows.

   <bean id="SessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
      parent="AbstractSessionFactory" depends-on="AppConfigHelper">
    <property name="hibernateProperties">
      <props>
        <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
     </props>
    </property>
    <property name="dataSource" ref="dataSource" />

I didn’t define persistant.xml file. Is it the reason behind this exception?
My doubt is that, since everything hibernate wants(database connection & class mapping) is specified through configuration and annotations, why do we need to specify persistance.xml file explicitly?

  • 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-13T12:55:36+00:00Added an answer on June 13, 2026 at 12:55 pm

    If you’re using annotations then you have to use class=”org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean”

    Example :

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="annotatedClasses">
            <list>
                <value>package.classname</value>
            </list>
        </property>
    
    • 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 composition in hibernate with annotations. I have: @Entity @Table(name =
I am trying to use Hibernate to do save/load objects that look like this
Im trying to convert the Vaadin demo for JPAContainer to use hibernate instead of
I am trying to use Envers on a project that also uses Hibernate and
My application is trying to use Hibernate annotations. I've gotten the 3.5.0 version of
I'm trying to use Hibernate 4 with annotations only, and a hibernate.cfg.xml file. I've
I was trying some hands on with Hibernate annotations. When I tried to use
I'm trying to use Hibernate to retrieve approximately 100 million rows from a table.
trying to use hibernate with my web app and getting following exception: Initial SessionFactory
I have been trying to use the hibernate dialect for SQLite from http://code.google.com/p/hibernate-sqlite/ in

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.