mysql - CRUD repository not returning the Super Class data -
i have class extends of basic properties class. using crud repository communicate mysql database. not getting values fields defined in base class.
ex: getting createdby , modifiedby null.
entity class
@jsoninclude(jsoninclude.include.non_null) @entity @table(name = "user") class user extends baseentity { @jsonproperty("id") @id @generatedvalue(strategy = generationtype.auto) @column(name = "id") private string id; @jsonproperty("firstname") @column(name = "first_name") private string firstname; @jsonproperty("lastname") @column(name = "last_name") private string lastname; /** * @return id */ public string getid() { return id; } /** * @param id id set */ public void setid(string id) { this.id = id; } /** * @return firstname */ public string getfirstname() { return firstname; } /** * @param firstname firstname set */ public void setfirstname(string firstname) { this.firstname = firstname; } /** * @return lastname */ public string getlastname() { return lastname; } /** * @param lastname lastname set */ public void setlastname(string lastname) { this.lastname = lastname; } }
base class
class baseentity { @jsonproperty("createdby") @column(name = "created_by") public string createdby; @jsonproperty("modifiedby") @column(name = "modified_by") public string modifiedby; /** * @return createdby */ public string getcreatedby() { return createdby; } /** * @param createdby createdby set */ public void setcreatedby(string createdby) { this.createdby = createdby; } /** * @return modifiedby */ public string getmodifiedby() { return modifiedby; } /** * @param modifiedby modifiedby set */ public void setmodifiedby(string modifiedby) { this.modifiedby = modifiedby; } }
repository
@transactional public interface userrepo extends crudrepository < user, string > {}
service implementation method
public user getuser(string userid) { user user = gunifyuserrepository.findone(userid); //here data createdby , modifiedby returned null though have value in db return response; }
any appreciated.
public class baseentity implements serializable { @lastmodifieddate private date lastmodified; @createddate private date createdat;
use above code, , let me know
Comments
Post a Comment