hibernate - Could not determine type for: java.util.Set -
this classes user , catalog... 1 user have many catalog.
package com.egs.account.model; import org.apache.commons.lang.builder.equalsbuilder; import javax.persistence.*; import java.util.date; import java.util.set; @entity @table(name = "user") public class user { private long id; private string username; private string password; private string passwordconfirm; private string firstname; private string lastname; private date dateregistered; private long skypeid; private set<role> roles; @onetomany(mappedby = "user", cascade = cascadetype.all) private set<catalog> catalogs; @id @generatedvalue(strategy = generationtype.auto) public long getid() { return id; } public void setid(long 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; } @transient public string getpasswordconfirm() { return passwordconfirm; } public void setpasswordconfirm(string passwordconfirm) { this.passwordconfirm = passwordconfirm; } public string getfirstname() { return firstname; } public void setfirstname(string firstname) { this.firstname = firstname; } public date getdateregistered() { return dateregistered; } public void setdateregistered(date dateregistered) { this.dateregistered = dateregistered; } public long getskypeid() { return skypeid; } public void setskypeid(long skypeid) { this.skypeid = skypeid; } public string getlastname() { return lastname; } public void setlastname(string lastname) { this.lastname = lastname; } public set<role> getroles() { return roles; } public void setroles(set<role> roles) { this.roles = roles; } public set<catalog> getcatalogs() { return catalogs; } public void setcatalogs(set<catalog> catalogs) { this.catalogs = catalogs; } @override public int hashcode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashcode()); result = prime * result + ((firstname == null) ? 0 : firstname.hashcode()); return result; } @override public boolean equals(final object obj) { if (!(obj instanceof user)) { return false; } if (obj == this) { return true; } final user other = (user) obj; final equalsbuilder builder = new equalsbuilder(); builder.append(this.firstname, other.firstname); builder.append(this.lastname, other.lastname); builder.append(this.username, other.username); builder.append(this.skypeid, other.skypeid); return builder.isequals(); } @override public string tostring() { return "userdocument [id=" + id + ", name=" + firstname + ", lastname=" + lastname + ", username=" + username + "]"; } }
and 1 catalog class.
package com.egs.account.model; import javax.persistence.*; import java.util.date; @entity @table(name = "user") public class catalog { @id @generatedvalue(strategy = generationtype.auto) private long id; private string link; private string comment; private date insertdate; @manytoone(optional = false) @joincolumn(name = "user_id") private user user; @lob @basic(fetch = fetchtype.lazy) @column(name="content", nullable=false) private byte[] content; public long getid() { return id; } public void setid(long id) { this.id = id; } public string getlink() { return link; } public void setlink(string link) { this.link = link; } public string getcomment() { return comment; } public void setcomment(string comment) { this.comment = comment; } public date getinsertdate() { return insertdate; } public void setinsertdate(date insertdate) { this.insertdate = insertdate; } public user getuser() { return user;} public void setuser(user user) { this.user = user; } public byte[] getcontent() { return content; } public void setcontent(byte[] content) { this.content = content; } }
and when running application, kind of exception.
caused by: org.hibernate.mappingexception: not determine type for: java.util.set, @ table: user, columns: [org.hibernate.mapping.column(catalogs)]
anybody please tell me wrong code.
Comments
Post a Comment