java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -


i trying fetch records database , having above error

this classs appropriate getters , setters

public class user {     private int id;     private string username;     private string password;     private string email; 

i have create database , inserted data below configuration

<bean id="datasource" class="org.apache.commons.dbcp2.basicdatasource" destroy-method="close">         <property name="driverclassname" value="com.mysql.jdbc.driver"/>         <property name="url" value="jdbc:mysql://localhost:3306/usersdb"/>         <property name="username" value="root"/>         <property name="password" value=""/>     </bean>    

this complete stacktrace

severe: servlet.service() servlet [appservlet] in context path [/spring] threw exception [request processing failed; nested exception org.hibernate.exception.sqlgrammarexception: not extract resultset] root cause com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: table 'usersdb.users' doesn't exist     @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62)     @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45)     @ java.lang.reflect.constructor.newinstance(constructor.java:422)     @ com.mysql.jdbc.util.handlenewinstance(util.java:409) 

please wrong new on spring mvc hibernate

the complete code user.java

package net.codejava.spring.model;  public class user {     private int id;     private string username;     private string password;     private string email;      public int getid() {         return id;     }      public void setid(int id) {         this.id = id;     }      public string getusername() {         return username;     }      public void setusername(string username) {         this.username = username;     }      public string getpassword() {         return password;     }      public void setpassword(string password) {         this.password = password;     }      public string getemail() {         return email;     }      public void setemail(string email) {         this.email = email;     }  } 

you missing couple of things

import javax.persistence.cacheable; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.table; import javax.persistence.transient;  import org.codehaus.jackson.annotate.jsonproperty; import org.codehaus.jackson.map.annotate.jsonserialize; import org.hibernate.annotations.cache; import org.hibernate.annotations.cacheconcurrencystrategy;   import java.io.serializable; import java.util.date; @entity @table(name="user")  public class user implements serializable{ 

Comments

Popular posts from this blog

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -