java - Error using persist() -
i have code:
user.setfirstname(requ.getparameter("nombre")); user.setlastname(requ.getparameter("apellidos")); user.setemailaddress(requ.getparameter("email")); user.persist();
and i'm getting error:
validation failed classes [com.springsource.marshall.domain.user] during persist time groups [javax.validation.groups.default, ] list of constraint violations:[ constraintviolationimpl{interpolatedmessage='no puede ser null', propertypath=emailaddress, rootbeanclass=class com.springsource.marshall.domain.user, messagetemplate='{javax.validation.constraints.notnull.message}'} constraintviolationimpl{interpolatedmessage='no puede ser null', propertypath=password, rootbeanclass=class com.springsource.marshall.domain.user, messagetemplate='{javax.validation.constraints.notnull.message}'} constraintviolationimpl{interpolatedmessage='no puede ser null', propertypath=firstname, rootbeanclass=class com.springsource.marshall.domain.user, messagetemplate='{javax.validation.constraints.notnull.message}'} ]
i tried:
user user = new user();
system.out.println(requ.getparameter("email")); system.out.println(requ.getparameter("nombre")); system.out.println(requ.getparameter("apellidos")); user.setfirstname(requ.getparameter("nombre")); user.setlastname(requ.getparameter("apellidos")); user.setemailaddress(requ.getparameter("email")); user.setpassword("poruesadf"); system.out.println("user:"+user); user.persist();
and get:
myemail@hotmail.com myfirstname mylastname set firstname user, nombre:user[firstname=,lastname=,emailaddress=,password=,activationdate=,activationkey=,enabled=,locked=,id=,version=,clientes=,incidencias=,userroles=,empresaid=]
i don't know why user has parameter null...
here user_roo_dbmanaged.aj:
// warning: not edit file. file managed spring roo. // may push code target .java compilation unit if wish edit member(s). package com.springsource.marshall.domain; import com.springsource.marshall.domain.cliente; import com.springsource.marshall.domain.empresa; import com.springsource.marshall.domain.incidencia; import com.springsource.marshall.domain.user; import com.springsource.marshall.domain.userrole; import java.util.date; import java.util.set; import javax.persistence.column; import javax.persistence.joincolumn; import javax.persistence.manytoone; import javax.persistence.onetomany; import javax.persistence.temporal; import javax.persistence.temporaltype; import org.springframework.format.annotation.datetimeformat; privileged aspect user_roo_dbmanaged { @onetomany(mappedby = "userid") private set<cliente> user.clientes; @onetomany(mappedby = "userid") private set<incidencia> user.incidencias; @onetomany(mappedby = "userentry") private set<userrole> user.userroles; @manytoone @joincolumn(name = "empresa_id", referencedcolumnname = "id") private empresa user.empresaid; @column(name = "firstname", length = 99, insertable=false,updatable=false) private string user.firstname; @column(name = "lastname", length = 30, insertable=false,updatable=false) private string user.lastname; @column(name = "password", length = 100, insertable=false,updatable=false) private string user.password; @column(name = "emailaddress", length = 45, insertable=false,updatable=false) private string user.emailaddress; @column(name = "activationdate", insertable=false,updatable=false) @temporal(temporaltype.date) @datetimeformat(style = "m-") private date user.activationdate; @column(name = "activationkey", length = 45, insertable=false,updatable=false) private string user.activationkey; @column(name = "enabled", insertable=false,updatable=false) private boolean user.enabled; @column(name = "locked", insertable=false,updatable=false) private boolean user.locked; public set<cliente> user.getclientes() { return clientes; } public void user.setclientes(set<cliente> clientes) { this.clientes = clientes; } public set<incidencia> user.getincidencias() { return incidencias; } public void user.setincidencias(set<incidencia> incidencias) { this.incidencias = incidencias; } public set<userrole> user.getuserroles() { return userroles; } public void user.setuserroles(set<userrole> userroles) { this.userroles = userroles; } public empresa user.getempresaid() { return empresaid; } public void user.setempresaid(empresa empresaid) { this.empresaid = empresaid; } public string user.getfirstname() { return firstname; } public void user.setfirstname(string firstname) { this.firstname = firstname; } public string user.getlastname() { return lastname; } public void user.setlastname(string lastname) { this.lastname = lastname; } public string user.getpassword() { return password; } public void user.setpassword(string password) { this.password = password; } public string user.getemailaddress() { return emailaddress; } public void user.setemailaddress(string emailaddress) { this.emailaddress = emailaddress; } public date user.getactivationdate() { return activationdate; } public void user.setactivationdate(date activationdate) { this.activationdate = activationdate; } public string user.getactivationkey() { return activationkey; } public void user.setactivationkey(string activationkey) { this.activationkey = activationkey; } public boolean user.getenabled() { return enabled; } public void user.setenabled(boolean enabled) { this.enabled = enabled; } public boolean user.getlocked() { return locked; } public void user.setlocked(boolean locked) { this.locked = locked; } }
does have possible solution?
thanks!!
Comments
Post a Comment