org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped [from User]

The above run-time exception is thrown when the servlet config file is not configured correctly

Check for the below configuration snippet in your applicationContext.xml file

<bean id=”sessionFactory” class=”org.springframework.orm.hibernate4.LocalSessionFactoryBean”>
<property name=”dataSource” ref=”dataSource” />
// only the property “annotatedClasses” of the class LocalSessionFactoryBean is to be used to make Spring understand the annotated model class used as table.
<property name=”annotatedClasses”>
<list>
<value>testspringmvc.domain.User</value>
</list>
</property>
<property name=”hibernateProperties”> <props> <prop key=”hibernate.dialect”>org.hibernate.dialect.MySQL5Dialect</prop> <prop key=”hibernate.show.sql”>true</prop> <prop key=”hibernate.connection.driver_class”>com.mysql.jdbc.Driver</prop> <prop key=”hibernate.connection.url”>jdbc:mysql://localhost:3306/test</prop> <prop key=”hibernate.connection.username”>root</prop> <prop key=”hibernate.connection.password”>gaims</prop> <prop key=”hibernate.connection.pool_size”>1</prop> <!– <prop key=”hibernate.hbm2dll.auto”>validate</prop> –> </props> </property> </bean>
Hope this was helpful. Add for more.
Thanks.

Leave a Reply