2

私はこのコードを持っています:

user.setFirstName(requ.getParameter("nombre"));
user.setLastName(requ.getParameter("apellidos"));
user.setEmailAddress(requ.getParameter("email"));

user.persist();

そして、私はこのエラーが発生しています:

グループ [javax.validation.groups.Default, ] の持続時間中にクラス [com.springsource.marshall.domain.User] の検証に失敗しました, 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.ユーザー、messageTemplate='{javax.validation.制約.NotNull.メッセージ}'}]

私は試した:

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();

そして私は得る:

myemail@hotmail.com myfirstname mylastname set firstname User, nombre:User[firstName=,lastName=,emailAddress=,password=,activationDate=,activationKey=,enabled=,locked=,id=,version=,clientes=,incidencias= ,userRoles=,empresaId=]

User のすべてのパラメータが null である理由がわかりません...

ここに私のUser_Roo_DbManaged.ajがあります:

// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any 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;
    }

}

誰にも可能な解決策はありますか?

ありがとう!!

4

0 に答える 0