hibernate - com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column -


i have 2 table student , address.i using hibernate 3 annotation here.

my student class

package net.viralpatel.contact.form;  import javax.persistence.cascadetype; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.id; import javax.persistence.manytoone; import javax.persistence.table;  @entity @table(name = "student") public class student {      private long studentid;     private string studentname;     private address studentaddress;      public student() {     }      public student(string studentname, address studentaddress) {         this.studentname = studentname;         this.studentaddress = studentaddress;     }      @id     @generatedvalue     @column(name = "student_id")     public long getstudentid() {         return this.studentid;     }      public void setstudentid(long studentid) {         this.studentid = studentid;     }      @column(name = "student_name", nullable = false, length = 100)     public string getstudentname() {         return this.studentname;     }      public void setstudentname(string studentname) {         this.studentname = studentname;     }      @manytoone(cascade = cascadetype.all)     public address getstudentaddress() {         return this.studentaddress;     }      public void setstudentaddress(address studentaddress) {         this.studentaddress = studentaddress;     }  } 

address class

import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.id; import javax.persistence.table;  @entity @table(name = "address") public class address {      private long addressid;     private string street;     private string city;     private string state;     private string zipcode;      public address() {     }      public address(string street, string city, string state, string zipcode) {         this.street = street;         this.city = city;         this.state = state;         this.zipcode = zipcode;     }      @id     @generatedvalue     @column(name = "address_id")     public long getaddressid() {         return this.addressid;     }      public void setaddressid(long addressid) {         this.addressid = addressid;     }      @column(name = "address_street", nullable = false, length=250)     public string getstreet() {         return this.street;     }      public void setstreet(string street) {         this.street = street;     }      @column(name = "address_city", nullable = false, length=50)     public string getcity() {         return this.city;     }      public void setcity(string city) {         this.city = city;     }      @column(name = "address_state", nullable = false, length=50)     public string getstate() {         return this.state;     }      public void setstate(string state) {         this.state = state;     }      @column(name = "address_zipcode", nullable = false, length=10)     public string getzipcode() {         return this.zipcode;     }      public void setzipcode(string zipcode) {         this.zipcode = zipcode;     }  } 

hibernate config file

<?xml version='1.0' encoding='utf-8'?> <!doctype hibernate-configuration public     "-//hibernate/hibernate configuration dtd//en"     "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">   <hibernate-configuration>     <session-factory>         <mapping class="net.viralpatel.contact.form.contact" />         <mapping class="net.viralpatel.contact.form.student" />         <mapping class="net.viralpatel.contact.form.address" />     </session-factory>  </hibernate-configuration> 

i got error

com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: unknown column 'student0_.studentaddress_address_id' in 'field list'

anybody know exact issue

help highly appreciated, thanks, shihab.

how address class like? seems error address object not having address_id field. check database if contains address_id.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -