Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Hibernate throws strange error: Class is not mapped

Instead of

Query query = session.createQuery("select p from Payment p");

try this

Query query = session.createQuery("select p from " + Payment.class.getName() + " p");

I'd expect one of two things to be the reason:

  1. either you don't have Payment listed in your hibernat.cfg.xml or where ever you config your mapped classes.

  2. another reason might be the confusion between javax...Entity and org.hibernate....Entity. Make sure you use the first one.

Tags:

Java

Hibernate

Orm

Jpa

Hibernate Mapping

Related

Java Reflection: How can I get the all getter methods of a java class and invoke them Jenkins Slave Environment Variable Refresh Xcode custom build configuration causes "library/file not found" for static libraries Remove accents from String Reset Embedded H2 database periodically Get most recent row for given ID How do I move a relative symbolic link? What is the difference between weak and strong resistance How can I connect xaml and xaml.cs files How to set highlight color for ListView item? How to temporary hide stdout or stderr while running a unittest in Python Make a number a percentage

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy