java - Empty Entity after data retrieving from MySQL DB -


i have following entity

import static javax.persistence.generationtype.identity;  import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.id; import javax.persistence.table; import javax.persistence.uniqueconstraint;  import org.hibernate.annotations.type;  @entity @table(name = "privilege", uniqueconstraints = @uniqueconstraint(columnnames = "name")) public class privilege implements java.io.serializable { private static final long serialversionuid = 8357379972506504809l;  private long privilegeid; private string name; private string description;  public privilege() { }  @id @generatedvalue(strategy = identity) @column(name = "privilegeid", unique = true, nullable = false) public long getid() {     return this.privilegeid; }  public void setid(long privilegeid) {     this.privilegeid = privilegeid; }   @column(name = "name", unique = true, length = 45) public string getname() {     return this.name; }  public void setname(string name) {     this.name = name; }   @column(name = "description", length = 65535) @type(type="text") public string getdescription() {     return this.description; }  public void setdescription(string description) {     this.description = description; }  } 

which maps table in mysql db. i'm trying retrieve data though following querydsl code

public privilege findbyname(final string name) throws entitynotfoundexception {         privilege workgroupprivilege = new jpaquery(getentitymanager())                 .from(privilege)                 .where(privilege.name.eq(name))                 .uniqueresult(privilege);         if (workgroupprivilege == null)             throw new entitynotfoundexception("cannot find entity "                     + privilege.class.getcanonicalname()                     + " name <" + name + ">");         else             return workgroupprivilege;     } 

the problem findbyname() code returns me instance of privilege entity object data in fields null. means entity-db table binding correctly done (otherwhise have had null privilege entity instance).

edit:

the web app adds field empty instance of privilege

handler = org.hibernate.proxy.pojo.javassist.javassistlazyinitializer@48f52e0b 

may added field key solve problem?

what can problem ?

the debugger showing me no data because of lazy data loading.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -