I’m sure that many hours must have been spent by Spring/Hibernate users trying to figure out why they are getting the table not mapped exception when they are sure that have mapped the table. Well the problem can be fixed if you take care of the case (upper vs. lower case). Suppose that the name of your table is user and the name of the your class is User.Here is the crux of the problem:This is the wrong version that leads to the not mapped exception:getHibernateTemplate().find("from user");Here is the correct version:getHibernateTemplate().find("from User");You see the problem is that in the hibernate version of the SQL, you are expected to use the name of your class and not the name of the table. Typically, the name of the table is all in lowercase and the name of the class starts with an uppercase. Yep programming can be very frustrating.
Spring & Hibernate’s not mapped problem
Advertisement
November 17, 2007 at 11:18 am |
I find this really bizarre. My mapping is
so the query actually looks like
s.createQuery(“from UserVO”)
I’m sure the manual has good justification for this if I can find it.
May 4, 2008 at 3:02 pm |
I have had the same problem, but I have also have to put the mapping in the hibernate.cfg.xml in the test/resource folder and in the application context of the test.
August 20, 2010 at 9:06 am |
outch, I was hours trying. Thanks =)
December 2, 2010 at 12:42 pm |
Thank youuuuuuuuu, it’s very helpful you saved my time))
December 16, 2010 at 11:32 am |
HI Shahram Javey
THanks a lo…………….ot,I juist did the same mistake,was tryign to map to the table name and was breaking my head……..
Keep up this good work and posting such useful advices
December 16, 2010 at 6:05 pm |
Thank you for your comment. I’m glad this entry proved useful to you.