java - Mapping Exception in Collection saving as Member Variable in Hibernate -


following exception coming why don't know please me solve

exception in thread "main" org.hibernate.mappingexception: not determine type for: java.util.list, @ table: user_detail, columns: [org.hibernate.mapping.column(listofaddress)]

 @entity   @table (name="user_detail") public class usersdetail {  private int id;                                         // @column (name ="name") private string name; @elementcollection private list<address> listofaddress = new arraylist<address>();   @id @generatedvalue @column (name ="id") public int getid() {     return id; } public void setid(int id) {     this.id = id; } public string getname() {     return name; } public void setname(string name) {     this.name = name; } public list<address> getlistofaddress() {     return listofaddress; } public void setlistofaddress(list<address> listofaddress) {     this.listofaddress = listofaddress; }} 

hi think issue placement of annotations. using method access strategy (determined @id annotation). put jpa related annotation right above each getter instead of field members.

like below:-

@column (name ="name") public string getname() {     return name; }  @elementcollection public list<address> getlistofaddress() {     return listofaddress; } 

Comments